Constructor
new NewgroundsPlugin(app_id, cipheropt, cryptoJSopt)
Create the global newgrounds object
| Name | Type | Attributes | Description |
|---|---|---|---|
app_id | string | 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
// create the newgrounds object, replace the app id with your own
const app_id = 'your_app_id_here';
new NewgroundsPlugin(app_id);Members
app_id
Properties| Type | Description |
|---|---|
| string | The newgrounds App ID |
- Source
cipher
Properties| Type | Description |
|---|---|
| string | | AES-128/Base64 encryption key, if any |
- Source
cryptoJS
Properties| Type | Description |
|---|---|
| Object | | CryptoJS instance used when cipher is set |
- Source
host
Properties| Type | Description |
|---|---|
| string | Hostname used when logging views |
- Source
medals
Properties| Type | Description |
|---|---|
| Array | Medals fetched from Newgrounds (empty until session is active) |
- Source
scoreboards
Properties| Type | Description |
|---|---|
| Array | Scoreboards fetched from Newgrounds |
- Source
session_id
Properties| Type | Description |
|---|---|
| string | | Newgrounds session id from the URL (null when not logged in) |
- Source
Methods
call(component, parametersopt, asyncopt) → {Object}
Send a message to call a component of the Newgrounds API
| 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
- The response JSON object
- Type:
- Object
getScores(id, useropt, socialopt, skipopt, limitopt) → {Object}
Get scores from a scoreboard
| 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 over |
limit | number | <optional> | 10 | Number of scores to include in the list |
- Source
- The response JSON object
- Type:
- Object
logView()
Send message to log a view
- Source
postScore(id, value)
Send message to post score
| Name | Type | Description |
|---|---|---|
id | number | The scoreboard id |
value | number | The score value |
- Source
unlockMedal(id)
Send message to unlock a medal by id
| Name | Type | Description |
|---|---|---|
id | number | The medal id |
- Source