Skip to content

NewgroundsJS

Methods

connect()

connect(appID, encKey): NewgroundsClient

Create a client and connect to the Newgrounds API

Parameters

ParameterTypeDescription
appIDstringThe app id found on the Newgrounds API project page
encKeystringThe encryption key found on the Newgrounds API project page

Returns

NewgroundsClient

A new NewgroundsClient

Source

newgrounds.d.ts:407


getCloudData()

getCloudData(id): Promise<string>

Get cloud data from a save slot

Parameters

ParameterTypeDescription
idnumberThe id of the save slot

Returns

Promise<string>

The data stored in the save slot

Source

newgrounds.d.ts:464


getScores()

getScores(scoreboardID, opt): Promise<Score[]>

Get the scores for a scoreboard

Parameters

ParameterTypeDescription
scoreboardIDnumberThe id of the scoreboard to get scores from
optScoreBoardGetScoresParams-

Returns

Promise<Score[]>

Scores corresponding to the scoreboard

Source

newgrounds.d.ts:429


getUsername()

getUsername(): Promise<string>

Get the username of the current user

Returns

Promise<string>

The username of the current user, if they are logged in

Source

newgrounds.d.ts:444


getVersion()

getVersion(): Promise<string>

Get the version of your Newgrounds Project

Returns

Promise<string>

The version of your Newgrounds Project

Source

newgrounds.d.ts:450


isSupporter()

isSupporter(): Promise<boolean>

Check if the current user is a supporter

Returns

Promise<boolean>

A boolean indicating if the user is a supporter, if they are logged in

Source

newgrounds.d.ts:456


login()

login(): Promise<User>

Log in the user

Returns

Promise<User>

The user that was logged in

Source

newgrounds.d.ts:413


postScore()

postScore(scoreboardID, value): Promise<Score>

Post a score to a scoreboard

Parameters

ParameterTypeDescription
scoreboardIDnumberThe id of the scoreboard to post the score to
valuenumberThe value of the score

Returns

Promise<Score>

The Score that was posted to the board.

Source

newgrounds.d.ts:438


setCloudData()

setCloudData(id, value): Promise<SaveSlot>

Set cloud data in a save slot

Parameters

ParameterTypeDescription
idnumberThe id of the save slot
valuestringThe value to store in the save slot

Returns

Promise<SaveSlot>

The save slot that was updated

Source

newgrounds.d.ts:473


unlockMedal()

unlockMedal(medalID): Promise<boolean>

Unlock a medal

Parameters

ParameterTypeDescription
medalIDnumberThe id of the medal to unlock

Returns

Promise<boolean>

A boolean indicating if the medal was unlocked

Source

newgrounds.d.ts:421

Properties

PropertyTypeDescription
NewgroundsClienttypeof NewgroundsClientThe NewgroundsClient class