Last active
June 10, 2020 13:09
-
-
Save antonjb/2013615bc64c81239b691ec1040b4a12 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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