Skip to content

Instantly share code, notes, and snippets.

@axelnormand
Last active October 7, 2020 14:01
Show Gist options
  • Save axelnormand/7be5a5d98004ee5482c33d7ab04bdc65 to your computer and use it in GitHub Desktop.
Save axelnormand/7be5a5d98004ee5482c33d7ab04bdc65 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 ideaMachine = Machine({
id: "idea",
initial: "draft",
context: {
isEvaluated: false,
canIdeaBeInCuration: false,
isIdeaInUserScore: false,
},
states: {
draft: {
on: {
SUBMIT: {
target: "active",
actions: assign({
isEvaluated: (context, event) => true,
}),
},
DELETE: {
target: "active",
actions: assign({
isEvaluated: (context, event) => false,
}),
},
},
},
deleted: {
type: "final",
},
closed: {
type: "final",
},
expired: {
type: "final",
},
evaluated: {
type: "final",
},
active: {
on: {
CLOSE: "closed",
DELETE: {
target: "active",
actions: assign({
isEvaluated: (context, event) => false,
}),
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment