Skip to content

Instantly share code, notes, and snippets.

@MrKou47
Last active June 15, 2021 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrKou47/62b2f6532e4055be5556b39e1ad4de6e to your computer and use it in GitHub Desktop.
Save MrKou47/62b2f6532e4055be5556b39e1ad4de6e 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: 'fetch',
initial: '未配置',
context: {
retries: 0
},
states: {
['未配置']: {
on: {
CLICK: '已配置'
}
},
已配置: {
on: {
已领取: '预告',
今天: '待领取',
明天: '预告',
}
},
预告: {
type: 'final'
},
待领取: {
on: {
领取: '预告'
}
},
failure: {
on: {
RETRY: {
target: '已配置',
actions: assign({
retries: (context, event) => context.retries + 1
})
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment