Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including state-handler with all npm packages installed. Try it out:

const StateHandler = require('state-handler') const state = { items: [] } const sh = StateHandler(state) const off = sh.on( (s) => s.items.length === 2, (s) => console.log(JSON.stringify(s.items)), (s) => s.items = [] ) state.items.push(1) sh.exec() // NOP state.items.push(2) sh.exec() // exec off() state.items.push(3) state.items.push(4) sh.exec() // NOP

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

state-handler v1.0.4

State based function chain executor

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free