Last active
October 9, 2020 01:15
-
-
Save mfeckie/43c6e2b97aec8dbc224ee76ff76ee91e 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
id: 'day', | |
initial: "idle", | |
states: { | |
idle: { | |
on: { FOCUS: "focussed" }, | |
}, | |
focussed: { | |
on: { | |
ARROW_UP: { | |
actions: 'handleArrowUp' | |
}, | |
ARROW_DOWN: { | |
actions: 'handleArrowDown' | |
}, | |
USER_INPUT: { | |
actions: 'handleUserInput' | |
}, | |
ARROW_RIGHT: { | |
target: "visited", | |
actions: 'validate' | |
}, | |
TAB: { | |
target: "visited", | |
actions: "validate" | |
}, | |
BLUR: { | |
target: "visited", | |
actions: 'validate' | |
} | |
} | |
}, | |
visited: { | |
type: 'final', | |
on: { | |
FOCUS: 'focussed' | |
} | |
} | |
}, | |
}, { | |
actions: { | |
handleArrowUp() {}, | |
handleArrowDown() {}, | |
handleUsrInput() {}, | |
validate() {}, | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment