Skip to content

Instantly share code, notes, and snippets.

@chrisdhanaraj
Created July 15, 2019 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdhanaraj/015c1d59b99572b8566ca1567477c3da to your computer and use it in GitHub Desktop.
Save chrisdhanaraj/015c1d59b99572b8566ca1567477c3da 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 pingMachine = Machine({
id: 'ping',
initial: 'active',
states: {
active: {
// Sends 'PING' event to child machine with ID 'pong'
entry: send('PING', { to: 'pong' }),
on: {
PONG: {
actions: send('PING', {
to: 'pong',
delay: 1000
})
}
}
}
}
});
// Invoked child machine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment