New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@webxdc/highscores

Package Overview
Dependencies
Maintainers
0
Versions
6
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.0.2 to 5.1.0

src/highscores.css

19

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

@@ -19,19 +19,17 @@ "author": "adbenitez",

"homepage": "https://github.com/webxdc/highscores",
"main": "./dist/highscores.umd.js",
"module": "./dist/highscores.mjs",
"types": "./dist/highscores.d.ts",
"main": "./src/highscores.js",
"module": "./src/highscores.js",
"types": "./src/highscores.d.ts",
"source": "./src/highscores.js",
"files": [
"dist"
"src"
],
"exports": {
".": {
"import": "./dist/highscores.mjs",
"require": "./dist/highscores.umd.js"
"import": "./src/highscores.js"
},
"./dist/highscores.css": "./dist/highscores.css"
"./src/highscores.css": "./src/highscores.css"
},
"devDependencies": {
"prettier": "^3.3.3",
"vite": "^5.4.10"
"prettier": "^3.3.3"
},

@@ -42,3 +40,2 @@ "dependencies": {

"scripts": {
"build": "vite build",
"fix": "prettier --write .",

@@ -45,0 +42,0 @@ "check": "prettier --check ."

# Highscores
[![npm package](https://img.shields.io/npm/v/@webxdc/highscores.svg)](https://npmjs.com/package/@webxdc/highscores)
[![CI](https://github.com/webxdc/highscores/actions/workflows/ci.yml/badge.svg)](https://github.com/webxdc/highscores/actions/workflows/ci.yml)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
Library to facilitate the process of creating score-based webxdc games.

@@ -14,4 +18,25 @@ It can handle multiple scoreboards at the same time.

Import `@webxdc/highscores` lib (`webxdc.js` also needs to be included) in your `index.html`:
Quick overview of the API:
```js
import "@webxdc/highscores";
// always do this first, only use the API after init() finishes
await window.highscores.init();
// get current player's highscore
const score = window.highscores.getScore();
console.log(`your score: ${score}`);
// this will cause an announcement in chat only if it's a new highscore
window.highscores.setScore(score + 100);
const scoreboard = window.highscores.getHighScores();
scoreboard.forEach((player) => {
console.log(`${player.pos}. ${player.name} - ${player.score}`);
});
```
The `webxdc.js` lib also needs to be included in your `index.html`:
```html

@@ -23,3 +48,2 @@ <html>

<script src="webxdc.js"></script>
<script type="module">

@@ -36,23 +60,4 @@ import "@webxdc/highscores";

## Usage without modules
Check [dist/highscores.d.ts](https://github.com/webxdc/highscores/blob/main/dist/highscores.d.ts) file for documentation of the available API.
Include webxdc-scores lib (together with `webxdc.js`) in your `index.html`:
```html
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<script src="webxdc.js"></script>
<script src="./node_modules/@webxdc/highscores/dist/webxdc-scores.umd.js"></script>
</head>
<body>
...
</body>
</html>
```
Then you can access the API via `window.highscores` object, check [dist/highscores.d.ts](https://github.com/webxdc/highscores/blob/main/dist/highscores.d.ts) file for documentation of the available API.
For a full example check the [example/index.html](https://github.com/webxdc/highscores/blob/main/example/index.html) file.
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