Last active
July 30, 2020 10:48
-
-
Save roylee0704/5a55d998e4322d767cfbd26fc12e28fa 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 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