Newgrounds

Newgrounds API wrapper object

Constructor

new Newgrounds(app_id, cipheropt, cryptoJSopt)

Create a newgrounds object

Parameters:
NameTypeAttributesDescription
app_idNumber

The newgrounds App ID

cipherString<optional>

The encryption Key (AES-128/Base64)

cryptoJSObject<optional>

An instance of CryptoJS, if there is a cipher

Example
// create a newgrounds object, replace the app id with your own
const app_id = '53123:1ZuSTQ9l';
newgrounds = new Newgrounds(app_id);

Methods

call(component, parametersopt, asyncopt) → {Object}

Send a message to call a component of the Newgrounds API

Parameters:
NameTypeAttributesDefaultDescription
componentString

Name of the component

parametersObject<optional>
0

Parameters to use for call

asyncBoolean<optional>
0

If true, don't wait for response before continuing (avoid stall)

Returns:
  • The response JSON object
Type: 
Object

getScores(id, useropt, socialopt, skipopt, limitopt) → {Object}

Get scores from a scoreboard

Parameters:
NameTypeAttributesDefaultDescription
idNumber

The scoreboard id

userString<optional>
0

A user's id or name

socialNumber<optional>
0

If true, only social scores will be loaded

skipNumber<optional>
0

Number of scores to skip before start

limitNumber<optional>
10

Number of scores to include in the list

Returns:
  • The response JSON object
Type: 
Object

logView()

Send message to log a view

postScore(id, value)

Send message to post score

Parameters:
NameTypeDescription
idNumber

The scoreboard id

valueNumber

The score value

unlockMedal(id)

Send message to unlock a medal by id

Parameters:
NameTypeDescription
idNumber

The medal id