Newgrounds

Newgrounds API object

Constructor

new Newgrounds(app_id, cipheropt, cryptoJSopt)

Create the global newgrounds object

Parameters:
NameTypeAttributesDescription
app_idstring

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 the newgrounds object, replace the app id with your own
 const app_id = 'your_app_id_here';
 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>

Parameters to use for call

asyncboolean<optional>
false

If true, don't wait for response before continuing

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>

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