Skip to content

Instantly share code, notes, and snippets.

@Javarome
Created January 8, 2020 10:19
Show Gist options
  • Save Javarome/6396caa8a157c8e935e125b7556fc8df to your computer and use it in GitHub Desktop.
Save Javarome/6396caa8a157c8e935e125b7556fc8df 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 fetchMachine = Machine({
id: 'kn',
initial: 'draft',
context: {
retries: 0
},
states: {
draft: {
on: {
publish: 'to_publish',
'delete': 'to_delete'
}
},
to_publish: {
on: {
train: 'publishing',
save: 'draft',
'delete': 'to_delete'
}
},
publishing: {
on: {
training_done: 'published',
save: 'draft',
'delete': 'to_delete'
}
},
published: {
save: 'draft',
unpublish: 'to_unpublish',
'delete': 'to_delete'
},
to_unpublish: {
on: {
train: 'draft'
}
},
to_delete: {
on: {
train: 'deleted'
}
},
deleted: {
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment