Last active
June 15, 2021 09:23
-
-
Save MrKou47/62b2f6532e4055be5556b39e1ad4de6e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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: '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