Skip to content

Instantly share code, notes, and snippets.

@mbreton
Created July 2, 2020 16:38
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 mbreton/cc6e9dd049f975547bf6a8837abcf318 to your computer and use it in GitHub Desktop.
Save mbreton/cc6e9dd049f975547bf6a8837abcf318 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: 'consent',
initial: 'created',
context: {
},
states: {
created: {
on: {
start: {
target: 'started',
actions: ['sendPushNotif']
}
}
},
started: {
on: {
grant: 'OperationCommiting',
refuse: 'OperationRefusing',
cancel: 'OperationCanceling'
}
},
OperationCommiting: {
on: {
callBackIsOk : {
target:"granted",
actions: ['sendPushNotif']
},
callBackIsKo : {
target:"failed",
actions: ['sendPushNotif']
}
}
},
OperationRefusing: {
on: {
callBackIsOk : {
target:"refused",
actions: ['sendPushNotif']
},
callBackIsKo : {
target:"failed",
actions: ['sendPushNotif']
}
}
},
OperationCanceling: {
on: {
callBackIsOk : {
target:"canceled",
actions: ['sendPushNotif']
},
callBackIsKo : {
target:"failed",
actions: ['sendPushNotif']
}
}
},
granted: {
type: 'final'
},
refused: {
type: 'final'
},
canceled: {
type: 'final'
},
failed: {
type: 'final'
}
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment