Skip to content

Instantly share code, notes, and snippets.

@ShMcK
Created July 20, 2018 03:55
Show Gist options
  • Save ShMcK/51eb85560cbb3d76033618d3d1b1dc0b to your computer and use it in GitHub Desktop.
Save ShMcK/51eb85560cbb3d76033618d3d1b1dc0b to your computer and use it in GitHub Desktop.
xstateful setup
import { Machine } from 'xstate'
import { createStatefulMachine } from '@avaragado/xstateful'
import alarmMachine from './alarmMachine'
const alarm = createStatefulMachine({
machine: alarmMachine
})
alarm.init()
alarm.state.value // 'Idle'
alarm.transition('ALARM_TRIGGERED')
alarm.state.value // 'Ringing'
export default alarm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment