Last active
September 16, 2020 22:08
-
-
Save tcodes0/2d25b9857e04c2409d4a85265ee0efca to your computer and use it in GitHub Desktop.
new note
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
const newNoteMachine = Machine({ | |
id: 'newNoteMachine', | |
type: 'parallel', | |
context: { id: null }, | |
states: { | |
userPrompt: { | |
initial: 'prompting', | |
states: { | |
prompting: { on: { INPUT: { target: 'working' } }, invoke: { src: 'userPrompt_prompting' } }, | |
working: { | |
on: { NOTE_VALIDATION_FAILED: { target: 'invalidInput' }, NOTE_SAVED: { target: 'prompting' } }, | |
invoke: { src: 'userPrompt_working' }, | |
}, | |
invalidInput: { on: { OUTPUT_RESULT: { target: 'prompting' } } }, | |
}, | |
}, | |
newNoteFlow: { | |
initial: 'name', | |
states: { | |
name: { on: { NOTE_SAVED: { target: 'text', actions: 'saveId' } } }, | |
text: { on: { NOTE_SAVED: { target: 'tags' } } }, | |
tags: { on: { NOTE_SAVED: { target: 'links' } } }, | |
links: { on: { NOTE_SAVED: { target: 'done' } } }, | |
done: { type: 'final' }, | |
}, | |
}, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment