Skip to content

Instantly share code, notes, and snippets.

@faneder
Created October 28, 2020 15:07
Show Gist options
  • Save faneder/eaa03580e5db3077370842d9ab3b2a94 to your computer and use it in GitHub Desktop.
Save faneder/eaa03580e5db3077370842d9ab3b2a94 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 cleaarAllMachine = Machine({
id: 'cleaarAll',
initial: 'standby',
on: {
CLEAR_ALL: {
target: '.inProgress',
actions: assign({
clearCapIds: (_, event) => {
// Store the cap Id to array with adjustment
},
}),
},
},
states: {
standby: {
entry: assign({
clearCapIds: [],
}),
},
inProgress: {
invoke: {
src: 'clearAllAdjustments',
onDone: {
actions: ['updateTableData', 'clearFilters', 'refreshTable'],
target: 'standby',
},
onError: {
target: 'standby',
actions: send('Failed to clear adjustments.'),
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment