Created
September 23, 2019 04:50
-
-
Save gltovar/26d27d9fe2416bf2e043bdae49e3263f 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: 'infoChunk', | |
initial: 'loading', | |
states: { | |
loading: { | |
on: { | |
MARKED_FOR_DELETION: 'pendingDeletion', | |
MARKED_FOR_EDIT: 'pendingEdit', | |
RECEIVE_DATA: 'idle' | |
} | |
}, | |
pendingDeletion: { | |
on: { | |
SELECT: 'reviewDeletion' | |
} | |
}, | |
reviewDeletion: { | |
on: { | |
DELETE: 'complete', | |
KEEP: 'complete', | |
CANCEL: 'pendingDeletion' | |
} | |
}, | |
pendingEdit: { | |
on: { | |
SELECT: 'reviewEdit' | |
} | |
}, | |
reviewEdit: { | |
on: { | |
ACCEPT: 'complete', | |
REJECT: 'complete', | |
CANCEL: 'pendingEdit' | |
} | |
}, | |
idle: { | |
on: { | |
SELECT: 'edit' | |
} | |
}, | |
edit: { | |
on: { | |
UPDATE: 'complete', | |
DELETE: 'confirmDeletion', | |
CANCEL: 'idle' | |
} | |
}, | |
confirmDeletion: { | |
on: { | |
DELETE: 'complete', | |
CANCEL: 'edit' | |
} | |
}, | |
complete: { | |
type: 'final' | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment