Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

usevault

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

usevault

A React hook for creating a Vault score tracker.

latest
npmnpm
Version
1.0.0
Version published
Maintainers
0
Created
Source

useVault Hook

npm version

A React hook for creating a Vault score tracker. Written in Typescript.

Created by Jameson Brown @ Atomic10 Studio
Designed by Christopher Brown @ Barely Fiction Experiences

Installation

NPM

npm i usevault

Usage

const { gameState, addPlayer, ... } = useVault({ rounds: rounds })

Properties

PropTypeDescriptionDefault
roundsnumberThe number of rounds per game.10
roundTransitionDelaynumberThe number of ms for the transition between rounds.2000

Return Values

ValueTypeDescription
gameStateGameStateThe state of the game to provide key details.
gameState.round_overbooleanIf the current round has ended(7 out or all vaulted). roundTransitionDelay is the delay till this value auto resets.
gameState.game_overbooleanIf the game has ended(all rounds completed).
gameState.current_roundnumberThe number of the current round.
gameState.total_roundsnumberThe total number of rounds for the game. Set with props.rounds defaulting to 10.
gameState.playersPlayers[]List of players that doesn't change.
gameState.roll_queuePlayers[]List of players that reflects updates to turns, score, if vaulted, etc.
gameState.roll_historyRoll[]List of roll history. Length can be used for roll count, sum of roll.value can be used for round total.
addPlayerfunctionFunction to add new player to gameState.players and gameState.roll_queue.
removePlayerfunctionFunction to remove player from gameState.players and gameState.roll_queue.
rollDicefunctionFunction to record a new dice roll.
undoRollfunctionFunction to undo last dice roll. Can only undo dice roll from current round.
vaultfunctionFunction to vault a player with the current round score.
replayfunctionFunction to replay/restart a new round. Can update players and round count after calling this function but before rollDice

Keywords

vault

FAQs

Package last updated on 15 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts