Created
August 5, 2020 07:31
-
-
Save tklepzig/43794c56fe04d2a44f81e7f3f6cb23aa to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const rfidMachine = Machine({ | |
id: 'rfid', | |
initial: 'permanentlyDisarmed', | |
states: { | |
permanentlyDisarmed: { | |
on: { | |
SWITCH_ON: 'armed' | |
} | |
}, | |
temporarilyDisarmed: { | |
on: { | |
DOOR_OPEN: 'armed', | |
SWITCH_OFF: 'permanentlyDisarmed' | |
} | |
}, | |
armed: { | |
on: { | |
SCAN: 'temporarilyDisarmed', | |
DOOR_OPEN: 'preAlarm', | |
SWITCH_OFF: 'alarm' | |
} | |
}, | |
preAlarm: { | |
on: { | |
SCAN: 'temporarilyDisarmed', | |
SWITCH_OFF: 'alarm', | |
}, | |
after: { | |
15000: 'alarm' | |
} | |
}, | |
alarm: { | |
on: { | |
SCAN: 'temporarilyDisarmed' | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment