Skip to content

Instantly share code, notes, and snippets.

@tomByrer
Last active December 15, 2020 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomByrer/ca7ca265e8a8c7498a43f7888a14f10f to your computer and use it in GitHub Desktop.
Save tomByrer/ca7ca265e8a8c7498a43f7888a14f10f to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// 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