Skip to content

Instantly share code, notes, and snippets.

@laheadle
Created May 7, 2020 15:56
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 laheadle/bc046d2e3937a0d52c54a5280de81b2b to your computer and use it in GitHub Desktop.
Save laheadle/bc046d2e3937a0d52c54a5280de81b2b 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 fetchMachine = Machine({
"id" : "page-fetch",
"initial" : "waiting",
"context" : "initial-state-0",
"on" : {
"set-period" : {
"target" : "fetching",
"actions" : "reset"
}
},
"states" : {
"waiting" : { },
"fetching" : {
"initial" : "fetching-current",
"invoke" : {
"id" : "fetcher",
"src" : "launch-page-fetch"
},
"on" : {
"increment-page" : {
"target" : ".fetching-current",
"actions" : "increment-page"
},
"decrement-page" : {
"target" : ".fetching-current",
"actions" : "decrement-page"
},
"fetched" : {
"actions" : "set-fetched-page"
}
},
"states" : {
"fetching-current" : {
"on" : {
"fetched" : {
"target" : "fetching-next",
"internal" : false
}
}
},
"fetching-next" : {
"on" : {
"fetched" : {
"target" : "fetching-prev",
"internal" : false
}
}
},
"fetching-prev" : {
"on" : {
"fetched" : {
"target" : "done"
}
}
},
"done" : {
"type" : "final"
}
}
}
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment