Created
January 23, 2020 01:39
-
-
Save twelch/098824dc85f09e131376445efec58a02 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
id: 'fetch', | |
initial: 'inactive', | |
states: { | |
inactive: { | |
on: { | |
REGISTER: 'removed' | |
} | |
}, | |
removed: { | |
on: { | |
DEREGISTER: 'inactive', | |
SERVICE_START: 'available' | |
} | |
}, | |
available: { | |
on: { | |
SERVICE_END: 'removed', | |
AVAILABLE_LEAVE: 'elsewhere', | |
TRIP_START: 'trip', | |
RESERVE: 'reserved' | |
} | |
}, | |
elsewhere: { | |
on: { | |
SERVICE_START: 'available', | |
RESERVE_ENTER: 'reserved', | |
TRIP_ENTER: 'trip', | |
DEREGISTER: 'inactive' | |
} | |
}, | |
trip: { | |
on: { | |
TRIP_LEAVE: 'elsewhere', | |
TRIP_END: 'available', | |
TRIP_STOP: 'stopped' | |
} | |
}, | |
stopped: { | |
on: { | |
TRIP_RESUME: 'trip', | |
TRIP_START: 'trip', | |
} | |
}, | |
reserved: { | |
on: { | |
CANCEL_RESERVATION: 'available', | |
RESERVE_STOP: 'stopped', | |
RESERVE_LEAVE: 'elsewhere', | |
TRIP_START: 'trip' | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment