Created
August 7, 2020 07:07
-
-
Save tklepzig/ad7c82bbcc7a246c7d23495a64afdb14 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