Skip to content

Instantly share code, notes, and snippets.

@mfeckie
Last active October 10, 2020 03:19
Show Gist options
  • Save mfeckie/d78867b1d77f8d5fc239ead267b8b370 to your computer and use it in GitHub Desktop.
Save mfeckie/d78867b1d77f8d5fc239ead267b8b370 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 fetchMachine = Machine({
id: 'year',
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: {
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