Last active
December 15, 2020 03:00
-
-
Save tomByrer/ca7ca265e8a8c7498a43f7888a14f10f 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
// from tomByrer | |
let NAMES = { | |
id: 'enabledPlacer', | |
init: 'first', | |
alt: 'second', | |
third: '3rd', | |
} | |
const smBlender = Machine({ | |
id: [NAMES.id], | |
type: 'parallel', | |
states: { | |
placer: { | |
id: "placer", | |
initial: [NAMES.init], | |
states: { | |
[NAMES.init]: { | |
on: { | |
CHANGE: { | |
in: `#${NAMES.id}.disabler.enabled`, | |
target: [NAMES.alt], | |
} | |
}, | |
}, | |
[NAMES.alt]: { | |
on: { | |
CHANGE: { | |
in: `#${NAMES.id}.disabler.enabled`, | |
target: [NAMES.third], | |
} | |
}, | |
}, | |
[NAMES.third]: { | |
on: { | |
CHANGE: { | |
in: `#${NAMES.id}.disabler.enabled`, | |
target: [NAMES.init], | |
} | |
}, | |
}, | |
}, | |
}, | |
disabler: { | |
id: "disabler", | |
initial: 'enabled', | |
states: { | |
enabled: { | |
on: { DISABLE: 'disabled' }, | |
}, | |
disabled: { | |
on: { ENABLE: 'enabled' }, | |
}, | |
}, | |
}, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment