Skip to content

Instantly share code, notes, and snippets.

@trylovetom
Last active September 10, 2019 11:09
Show Gist options
  • Save trylovetom/bdf80fde80960e0d63f7228f713018ca to your computer and use it in GitHub Desktop.
Save trylovetom/bdf80fde80960e0d63f7228f713018ca to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const PassengerMachine = Machine({
id: '叫車服務(乘客端)',
initial: '地圖畫面',
states: {
'地圖畫面': {
on: {
'確認上下車地點': '訂單資訊畫面(金額、付款方式、特殊需求)'
}
},
'訂單資訊畫面(金額、付款方式、特殊需求)': {
on: {
'未登入': '登入畫面',
'已登入': '付款畫面'
}
},
'登入畫面': {
on: {
'登入流程': '付款畫面'
}
},
'付款畫面': {
on: {
'付款失敗': '付款畫面',
'訂單成立失敗': '訂單資訊畫面(金額、付款方式、特殊需求)',
'訂單成立,付款成功': '等待畫面'
}
},
'等待畫面': {
on: {
'找不到司機(訂單與付款放棄)': '訂單資訊畫面(金額、付款方式、特殊需求)',
'找到司機': '導航畫面(司機位置->上車位置)'
}
},
'導航畫面(司機位置->上車位置)': {
on: {
'乘客上車(司機控制)': '導航畫面(上車位置->下車位置)'
}
},
'導航畫面(上車位置->下車位置)': {
on: {
'乘客下車(司機控制)': '訂單結束'
}
},
'訂單結束': {
type: 'final'
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment