Skip to content

Instantly share code, notes, and snippets.

@Gi972
Last active May 11, 2020 05:29
Show Gist options
  • Select an option

  • Save Gi972/b777a800c45c3b982f588033f1aaf65d to your computer and use it in GitHub Desktop.

Select an option

Save Gi972/b777a800c45c3b982f588033f1aaf65d 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:"myEvent",
initial:"idle",
context:{
name:"",
date:new Date()
},
states:{
idle:{
on:{
WRITING:"write",
FETCH:"getEvent",
POST:"postEvent"
}
},
write:{
on:{
BLUR:'blur'
},
},
blur:{
on:{
after:{
1500:'idle'
}
},
},
postEvent:{
on:{
},
},
getEvent:{
on:{
},
}
,
succes:{
on:{},
after:{
2000:'idle'
}
},
failure:{}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment