Skip to content

Instantly share code, notes, and snippets.

@roylee0704
Last active July 30, 2020 10:48
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 roylee0704/5a55d998e4322d767cfbd26fc12e28fa to your computer and use it in GitHub Desktop.
Save roylee0704/5a55d998e4322d767cfbd26fc12e28fa to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const daikinMachine = Machine({
id: 'daikin',
initial: 'AwaitingPayment',
context: {
retries: 0
},
states: {
AwaitingPayment: {
on : {
RECEIVE_PAYMENT: 'Open'
}
},
Open: {
on : {
ASSIGN_TO_DISPATCHER: 'Accepted',
ACCEPT_BY_DISPATCHER: 'Accepted'
}
},
Accepted: {
on : {
ALLOCATE_TO_WORKER: 'Allocated',
CANCEL_BY_DISPATCHER: 'Cancelled',
CANCEL_BY_OPERATOR: 'Cancelled'
}
},
Allocated: {
on: {
TRAVEL: 'Travelling',
CANCEL_BY_DISPATCHER: 'Cancelled',
CANCEL_BY_OPERATOR: 'Cancelled'
}
},
Travelling: {
on: {
START_JOB: 'InProgress'
}
},
InProgress: {
on: {
FULLFILL: 'Completed'
}
},
Completed: {
type: 'final'
},
Cancelled: {
on: {
ASSIGN_TO_DISPATCHER: 'Accepted'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment