State
State management for all engines
Very fast cross-platform state management using bitwise operators.
Fast & 374B gzipped (because size matters)
Install
npm install @bastienrobert/state
Usage
import StateManager from '@bastienrobert/state'
const state = new StateManager(['STATE1', 'STATE2', 'STATE3'])
state.add('STATE1')
state.remove('STATE1')
state.add(['STATE1', 'STATE2'])
state.remove(['STATE1', 'STATE2'])
state.has('STATE1')
state.has(['STATE1', 'STATE2'])
state.get()
API
See the Documentation.
Contributions
Inspired by https://gist.github.com/bloodyowl/5729489.