ReadonlynameThe name of the leaderboard.
ReadonlyorderingHow the leaderboard should be ordered.
ReadonlyttlHow long entries on the leaderboard should last in seconds. Can be between 0-2 years. Setting 0 will result in default ttl which is 1 year. You must include this parameter when creating a leaderboard.
Exposes User DataGet information about the leaderboard, such as who is on it. The records returned carry other users' full information, so this exposes user data and cannot be combined with network modules such as ConnectedLensModule.
StaticgetReturns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns the name of this object's type.
Returns true if the object matches or derives from the passed in type.
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Exposes User DataSubmit a score to the leaderboard. The success callback hands back the submitting user's own record, which carries their full information, so this exposes user data and cannot be combined with network modules such as ConnectedLensModule. Use Leaderboard#submitScoreSafeInfo when the Lens also needs a network module.
Submit a score to the leaderboard, with a success callback that receives only non-sensitive user information. Unlike Leaderboard#submitScore this does not expose user data, so it can be used alongside network modules such as ConnectedLensModule.
//@input Asset.LeaderboardModule leaderboardModule
const options = Leaderboard.CreateOptions.create();
options.name = "highScores";
options.ttlSeconds = 64000;
options.orderingType = Leaderboard.OrderingType.Descending;
script.leaderboardModule.getLeaderboard(options, function (leaderboard) {
leaderboard.submitScoreSafeInfo(100, function (currentUserInfo) {
print(currentUserInfo.snapchatUser.name + " scored " + currentUserInfo.score);
}, function (status) {
print("submitScoreSafeInfo failed with status " + status);
});
}, function (message) {
print("getLeaderboard failed: " + message);
});
A leaderboard which can contain scores and information about participating users. Accessible through the
LeaderboardModuleasset.Example