Last active
May 9, 2020 07:51
-
-
Save thorgas/9ca2e68d8d79e26fdada6e7efa79259a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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
| const firestoreFetchMachine = Machine({ | |
| id: "myMachine", | |
| initial: "idle", | |
| context: { doc: { products: "a product" } }, | |
| states: { | |
| idle: { | |
| on: { | |
| INIT: "init" | |
| } | |
| }, | |
| init: { | |
| invoke: { | |
| id: "setDoc", | |
| src: (context, event) => PromiseFunction(context.doc), | |
| onDone: { | |
| target: "success", | |
| actions: (ctx, e) => console.log(e), // do stuff with your resolved Promise | |
| }, | |
| onError: { | |
| target: "failure", | |
| actions: (ctx, e) => console.log(e), // do stuff with your resolved Promise | |
| } | |
| } | |
| }, | |
| success: {}, | |
| failure: {} | |
| } | |
| }); // end of machine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment