Skip to content

Instantly share code, notes, and snippets.

@taktran
Last active July 17, 2020 12:01
Show Gist options
  • Save taktran/5fb8a6228690f36d9a18eae1a16c36ae to your computer and use it in GitHub Desktop.
Save taktran/5fb8a6228690f36d9a18eae1a16c36ae to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const workflowStatusMachine = Machine({
id: 'workflowStatus-v2-with-scheduled-publish',
initial: 'draft',
states: {
draft: {
on: {
PUBLISH: 'published',
SCHEDULE_PUBLISH: 'schedulePublished',
}
},
published: {
initial: 'noChanges',
states: {
noChanges: {
on: {
UPDATE_CONTENT: 'hasChanges'
}
},
hasChanges: {
on: {
REPUBLISH: 'noChanges'
}
}
},
on: {
UNPUBLISH: 'unpublished',
}
},
schedulePublished: {
on: {
SCHEDULED_PUBLISH: 'published'
}
},
unpublished: {
on: {
REPUBLISH: 'published',
SCHEDULE_PUBLISH: 'schedulePublished',
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment