Skip to content

Instantly share code, notes, and snippets.

@awchjimmy
Last active June 29, 2020 07:59
Show Gist options
  • Save awchjimmy/cad1b2ba1c7a25319ac482adabe8e0a0 to your computer and use it in GitHub Desktop.
Save awchjimmy/cad1b2ba1c7a25319ac482adabe8e0a0 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: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
聽課: '查看課程列表',
查成績: '成績單',
註冊: '申請註冊'
}
},
查看課程列表: {
on: {
選擇課程: '查看第幾堂',
返回: "idle"
}
},
查看第幾堂: {
on: {
選擇堂數: "開始播放",
返回: "查看課程列表"
}
},
開始播放: {
on: {
返回: "查看第幾堂"
}
},
成績單: {
on: {
返回: "idle"
}
},
申請註冊: {
on: {
返回: "idle"
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment