Skip to content

statehook/statehook.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

statehook.js

A state hook.

Installation

$ npm install statehook

API


StateHook.createHook([defaultValue])

Create a hook

var hook = StateHook.createHook();
// or
var hook = StateHook.createHook('default value');

hook.setState(newState) => newState

hook.getState() => any

hook.subscribe(subscriber) => unsubcribe()

hook.dispatch(args1, arg2, ..., argN) => void

hook.discard() => void

hook.isDiscarded() =>Boolean

About

An event-driven state hook.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published