Skip to content

Instantly share code, notes, and snippets.

@signaes
Last active July 15, 2020 17:47
Show Gist options
  • Save signaes/f957920d3928a6aa440b154b6914eb7d to your computer and use it in GitHub Desktop.
Save signaes/f957920d3928a6aa440b154b6914eb7d 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 messagesMachine = Machine({
id: 'messages',
initial: 'idle',
context: {
messages: {},
timestamp: new Date().getTime(),
},
states: {
idle: {
on: {
CHILD_ADDED: {
target: 'idle',
actions: ['add', 'updateTimestamp']
},
CHILD_CHANGED: {
target: 'idle',
actions: ['update', 'updateTimestamp']
}
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment