Skip to content

Instantly share code, notes, and snippets.

@antonjb
Last active June 10, 2020 13:09
Show Gist options
  • Save antonjb/2013615bc64c81239b691ec1040b4a12 to your computer and use it in GitHub Desktop.
Save antonjb/2013615bc64c81239b691ec1040b4a12 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 incidentMachine = Machine({
id: 'incident',
initial: 'opening',
context: {
channelId: null,
ticketId: null,
description: '',
level: null,
command: null
},
states: {
opening: {
on: {
OPENED: 'awaitCommand'
}
},
awaitCommand: {
on: {
ASSIGNED: 'active',
}
},
active: {
entry: ['setCommand'],
on: {
TRANSITION: 'transitioning'
}
},
transitioning: {
on: {
CLOSE: 'closed'
}
},
closed: {
type: 'final'
}
}
}, {
actions: {
setCommand: assign({ command: (ctx, evt) => evt.command })
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment