Skip to content

Instantly share code, notes, and snippets.

@a-y-u-s-h
Created August 18, 2021 21:43
Show Gist options
  • Save a-y-u-s-h/2fceefb481f41924e3a7774b111970af to your computer and use it in GitHub Desktop.
Save a-y-u-s-h/2fceefb481f41924e3a7774b111970af to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const application = Machine({
"id": "application",
"initial": "uninitialized",
"preserveActionOrder": true,
"context": {
"value": 1
},
"on": {
"telemetry": {
"actions": "telemetry"
}
},
"states": {
"uninitialized": {
"on": {
"initialize": {
"target": "initialized"
}
}
},
"initialized": {
"type": "parallel",
"states": {
"events": {
"invoke": {
"src": "events"
}
}
}
}
}
}, {
actions: {
telemetry: (c, e) => console.log(c, e)
},
activities: {},
services: {
events: (c, e) => (send, recieve) => {
setInterval(() => console.log("hello world"), 300)
setInterval(() => send("telemetry"), 300)
}
},
guards: {}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment