Last active
February 5, 2021 23:20
-
-
Save rschwabco/bfa189607b9e65ce0db4a350be902d9e 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 fleetScheduleApp = { | |
id: 'app', | |
initial: 'idle', | |
type: 'compound', | |
states: { | |
idle: { | |
id: 'app-idle', | |
on: { | |
eventClick: { | |
target: ".requirementSelected" | |
} | |
}, | |
states: { | |
requirementSelected: { | |
on: { | |
'': '#detailsPanel.visible' | |
} | |
}, | |
detailsPanel: { | |
id: 'detailsPanel', | |
states: { | |
hidden: { | |
type: 'final' | |
}, | |
visible: { | |
type: 'final' | |
} | |
} | |
} | |
} | |
}, | |
} | |
} | |
const fleetSchedule = Machine({ | |
id: 'app-preloader', | |
initial: 'preload', | |
type: 'compound', | |
context: { | |
selectedRequirement: {}, | |
selectedVessel: {}, | |
}, | |
states: { | |
ready: { | |
id: 'ready', | |
...fleetScheduleApp | |
}, | |
preload: { | |
invoke: { | |
src: 'loadData', | |
onDone: { | |
target: 'ready' | |
}, | |
onError: { | |
target: "failure", | |
}, | |
} | |
}, | |
failure: { | |
id: 'failure' | |
} | |
} | |
}, { | |
services: { | |
loadData: (context, event) => { | |
return new Promise((resolve, reject) => { | |
resolve() | |
}) | |
} | |
}, | |
actions: { | |
doAction: () => {} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment