Created
July 15, 2019 23:49
-
-
Save chrisdhanaraj/015c1d59b99572b8566ca1567477c3da 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 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