You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,12 @@
4
4
5
5
### Facebook Instant Games Updates and Fixes
6
6
7
+
* Added the `Leaderboard.getConnectedScores` method, to get a list of scores from player connected entries.
7
8
* The `loadPlayerPhoto` function in the Instant Games plugin now listens for the updated Loader event correctly, causing the `photocomplete` event to fire properly.
8
9
*`Leaderboard.setScore` now emits the LeaderboardScore object with the `setscore` event, as the documentation said it did.
9
10
*`Leaderboard.getPlayerScore` now only populates the `playerScore` property if the entry isn't `null`.
10
11
* If the `setScore` or `getPlayerScore` calls fail, it will return `null` as the score instance, instead of causing a run-time error.
12
+
* You can now pass an object or a string to `setScore` and objects will be automatically stringified.
Copy file name to clipboardExpand all lines: plugins/fbinstant/src/Leaderboard.js
+48-2Lines changed: 48 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -147,14 +147,19 @@ var Leaderboard = new Class({
147
147
* @since 3.13.0
148
148
*
149
149
* @param {integer} score - The new score for the player. Must be a 64-bit integer number.
150
-
* @param {string} [data] - Metadata to associate with the stored score. Must be less than 2KB in size.
150
+
* @param {(string|any)} [data] - Metadata to associate with the stored score. Must be less than 2KB in size. If an object is given it will be passed to `JSON.stringify`.
* The data is requested in an async call, so the result isn't available immediately.
228
233
*
229
-
* When the call completes this Leaderboard will emit the `getplayerscore` event along with the score and the name of the Leaderboard.
234
+
* When the call completes this Leaderboard will emit the `getscores` event along with an array of LeaderboardScore entries and the name of the Leaderboard.
@@ -259,6 +264,47 @@ var Leaderboard = new Class({
259
264
console.warn(e);
260
265
});
261
266
267
+
returnthis;
268
+
},
269
+
270
+
/**
271
+
* Retrieves a set of leaderboard entries, based on the current player's connected players (including the current player), ordered by local rank within the set of connected players.
272
+
*
273
+
* The data is requested in an async call, so the result isn't available immediately.
274
+
*
275
+
* When the call completes this Leaderboard will emit the `getconnectedscores` event along with an array of LeaderboardScore entries and the name of the Leaderboard.
* @param {integer} [count=10] - The number of entries to attempt to fetch from the leaderboard. Currently, up to a maximum of 100 entries may be fetched per query.
281
+
* @param {integer} [offset=0] - The offset from the top of the leaderboard that entries will be fetched from.
0 commit comments