Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webxdc/highscores

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webxdc/highscores - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

12

package.json
{
"name": "@webxdc/highscores",
"description": "Highscores API for webxdc apps",
"version": "5.2.0",
"version": "5.2.1",
"license": "MIT",

@@ -33,2 +33,6 @@ "author": "adbenitez",

},
"scripts": {
"fix": "prettier --write .",
"check": "prettier --check ."
},
"devDependencies": {

@@ -39,7 +43,3 @@ "prettier": "^3.3.3"

"jssha": "^3.3.1"
},
"scripts": {
"fix": "prettier --write .",
"check": "prettier --check ."
}
}
}

@@ -27,2 +27,7 @@ //@ts-check

onHighscoresChanged?: (scoreboard?: string) => void;
/** A function that returns the default initial score that is returned by window.highscores.getScore() if there is no highscore yet.
By default the initial score is zero, you need to provide this function if you
are not passing a number to window.highscores.setScore()
*/
getInitialScore?: (scoreboard?: string) => T;
};

@@ -29,0 +34,0 @@

@@ -7,3 +7,4 @@ import jsSHA from "jssha";

_compareScores = (score1, score2) => score1 - score2,
_onHighscoresChanged = () => {};
_onHighscoresChanged = () => {},
_getInitialScore = () => 0;
const maxserialKey = "_webxdc-scores_.max_serial",

@@ -28,3 +29,3 @@ scoreboardsKey = "_webxdc-scores_.scoreboards";

const players = scoreboards[scoreboard] || {};
return players[id] ? players[id].score : 0;
return players[id] ? players[id].score : _getInitialScore();
};

@@ -37,2 +38,3 @@

onHighscoresChanged,
getInitialScore,
} = {}) {

@@ -51,2 +53,6 @@ if (getAnnouncement) {

if (getInitialScore) {
_getInitialScore = getInitialScore;
}
scoreboards = JSON.parse(localStorage.getItem(scoreboardsKey) || "{}");

@@ -53,0 +59,0 @@ for (const scoreboard of Object.keys(scoreboards)) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc