Constructor
new Newgrounds(app_id, cipheropt, cryptoJSopt)
Create a newgrounds object
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
app_id | Number | The newgrounds App ID | |
cipher | String | <optional> | The encryption Key (AES-128/Base64) |
cryptoJS | Object | <optional> | An instance of CryptoJS, if there is a cipher |
- Source
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:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
component | String | Name of the component | ||
parameters | Object | <optional> | Parameters to use for call | |
async | Boolean | <optional> | false | If true, don't wait for response before continuing |
- Source
Returns:
- The response JSON object
- Type:
- Object
getScores(id, useropt, socialopt, skipopt, limitopt) → {Object}
Get scores from a scoreboard
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id | Number | The scoreboard id | ||
user | String | <optional> | A user's id or name | |
social | Number | <optional> | 0 | If true, only social scores will be loaded |
skip | Number | <optional> | 0 | Number of scores to skip before start |
limit | Number | <optional> | 10 | Number of scores to include in the list |
- Source
Returns:
- The response JSON object
- Type:
- Object
logView()
Send message to log a view
- Source
postScore(id, value)
Send message to post score
Parameters:
Name | Type | Description |
---|---|---|
id | Number | The scoreboard id |
value | Number | The score value |
- Source
unlockMedal(id)
Send message to unlock a medal by id
Parameters:
Name | Type | Description |
---|---|---|
id | Number | The medal id |
- Source