NewgroundsJS
Defined in: newgrounds.d.ts:415
Methods
Section titled “Methods”autoPing()
Section titled “autoPing()”autoPing(
ms):void
Defined in: newgrounds.d.ts:508
Automatically pings the Newgrounds API, this is useful for keeping the session alive
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ms |
number |
The interval in milliseconds |
Returns
Section titled “Returns”void
connect()
Section titled “connect()”connect(
appID,encKey,config?):NewgroundsClient
Defined in: newgrounds.d.ts:424
Create a client and connect to the Newgrounds API
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
appID |
string |
The app id found on the Newgrounds API project page |
encKey |
string |
The encryption key found on the Newgrounds API project page |
config? |
NewgroundsConfig |
- |
Returns
Section titled “Returns”NewgroundsClient
A new NewgroundsClient
getCloudData()
Section titled “getCloudData()”getCloudData(
id):Promise<string>
Defined in: newgrounds.d.ts:481
Get cloud data from a save slot
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
number |
The id of the save slot |
Returns
Section titled “Returns”Promise<string>
The data stored in the save slot
getScores()
Section titled “getScores()”Defined in: newgrounds.d.ts:446
Get the scores for a scoreboard
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
scoreboardID |
number |
The id of the scoreboard to get scores from |
opt |
ScoreBoardGetScoresParams |
- |
Returns
Section titled “Returns”Scores corresponding to the scoreboard
getUsername()
Section titled “getUsername()”getUsername():
Promise<string|undefined>
Defined in: newgrounds.d.ts:461
Get the username of the current user
Returns
Section titled “Returns”Promise<string | undefined>
The username of the current user, if they are logged in
getVersion()
Section titled “getVersion()”getVersion():
Promise<string>
Defined in: newgrounds.d.ts:467
Get the version of your Newgrounds Project
Returns
Section titled “Returns”Promise<string>
The version of your Newgrounds Project
isOnNewgrounds()
Section titled “isOnNewgrounds()”isOnNewgrounds():
boolean
Defined in: newgrounds.d.ts:496
Check if the game is current running on Newgrounds.com
Returns
Section titled “Returns”boolean
A boolean indicating if the game is running on Newgrounds.com
isSupporter()
Section titled “isSupporter()”isSupporter():
Promise<boolean|undefined>
Defined in: newgrounds.d.ts:473
Check if the current user is a supporter
Returns
Section titled “Returns”Promise<boolean | undefined>
A boolean indicating if the user is a supporter, if they are logged in
loadSoundID()
Section titled “loadSoundID()”loadSoundID(
id):Promise<ArrayBuffer>
Defined in: newgrounds.d.ts:515
A function to load a sound as a ArrayBuffer based on the provided ID.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string | number |
The ID of the sound to load. |
Returns
Section titled “Returns”A promise that resolves with the loaded sound as an ArrayBuffer.
login()
Section titled “login()”Defined in: newgrounds.d.ts:430
Log in the user
Returns
Section titled “Returns”The user that was logged in
ping()
Section titled “ping()”ping():
Promise<string>
Defined in: newgrounds.d.ts:502
Pings the Newgrounds API
Returns
Section titled “Returns”Promise<string>
“pong”
postScore()
Section titled “postScore()”Defined in: newgrounds.d.ts:455
Post a score to a scoreboard
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
scoreboardID |
number |
The id of the scoreboard to post the score to |
value |
number |
The value of the score |
Returns
Section titled “Returns”The Score that was posted to the board.
setCloudData()
Section titled “setCloudData()”Defined in: newgrounds.d.ts:490
Set cloud data in a save slot
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
number |
The id of the save slot |
value |
string |
The value to store in the save slot |
Returns
Section titled “Returns”The save slot that was updated
unlockMedal()
Section titled “unlockMedal()”unlockMedal(
medalID):Promise<boolean>
Defined in: newgrounds.d.ts:438
Unlock a medal
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
medalID |
number |
The id of the medal to unlock |
Returns
Section titled “Returns”Promise<boolean>
A boolean indicating if the medal was unlocked
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
NewgroundsClient |
typeof NewgroundsClient |
The NewgroundsClient class | newgrounds.d.ts:519 |
