Skip to content

Instantly share code, notes, and snippets.

@keithernet
keithernet / machine.js
Created August 6, 2021 14:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
const newMachine = {
id: 'newProduct',
initial: 'idle',
states: {
idle: {
on: {
save: 'saving'
}
},
saving: {
@keithernet
keithernet / machine.js
Last active May 27, 2021 23:14
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
const updateUserMachine = Machine({
id: 'fetch',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
FETCH: 'loading'
@keithernet
keithernet / machine.js
Last active May 21, 2021 15:33
Generated by XState Viz: https://xstate.js.org/viz
function fetchSecondOptions(someId){
return new Promise(resolve => {
setTimeout(() => resolve([]), 300);
});
}
function fetchThirdOptions(someId){
return new Promise(resolve => {
setTimeout(() => resolve([]), 500);
@keithernet
keithernet / machine.js
Last active May 20, 2021 16:51
Generated by XState Viz: https://xstate.js.org/viz
const form = Machine({
initial: 'noSelection',
states: {
noSelection: {
on: {
FIRST_SELECTED: 'firstSelected'
}
},
firstSelected: {
initial: 'awaitingSelection',

Keybase proof

I hereby claim:

  • I am keithernet on github.
  • I am keithernet (https://keybase.io/keithernet) on keybase.
  • I have a public key ASA7BTfXUdGa6q9-swXa0LLJmHHIi2P2_JtCF860gU4qWwo

To claim this, I am signing this object: