1.0.8 • Published 1 year ago

@clayinvaders/game-lib v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

game-lib

Lib to store params extracted from querystring in sessionStorage and send a request to server once with the score of the game.

Filter

Only querystring params starting with 'ci' will be Persisted to sessionStorage

Install

npm i @clayinvaders/game-lib

Use

const { storeQueryParams, getStoredQueryParams, sendScore } = require("@clayinvaders/game-lib")

#store querystring params to sessionStorage
storeQueryParams()

#get stored querystring params
const params = getStoredQueryParams(),

#send score the the backend api
const response = await sendScore(score)

#if error
response => { error: `messageError` }

#if success
response => { saved: ok }

Demo

The folder next contains a next app to try how it works.

Just run:

npm run dev`

# publish

npm publish --dry-run
npm publish --access=public
1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

1.0.0

1 year ago