Last active
September 29, 2019 07:37
-
-
Save fleksin/c235a95e82a79d0182ac16e1a560aa22 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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: 'stateMachine', | |
initial: 'isInApp', | |
states: { | |
isInApp: { | |
invoke: { | |
id: 'isInAlipay', | |
src: () => Promise.resolve(), | |
onDone: { | |
target: 'inApp', | |
}, | |
onError: { | |
target: 'notInApp', | |
}, | |
}, | |
}, | |
notInApp: { | |
invoke: { | |
id: 'notInAppThenWait', | |
src: () => Promise.resolve, | |
onDone: 'isInApp', | |
onError: 'notInApp', | |
}, | |
}, | |
inApp: { | |
initial: 'isInMiniApp', | |
states: { | |
isInMiniApp: { | |
invoke: { | |
id: 'isInMiniApp', | |
src: () => Promise.resolve(), | |
onDone: { | |
target: 'inMiniApp', | |
}, | |
onError: { | |
target: 'notInMiniApp', | |
}, | |
}, | |
}, | |
inMiniApp: { | |
// entry: () => { | |
// console.log('in mini app'); | |
// }, | |
type: 'final', | |
}, | |
notInMiniApp: { | |
entry: () => { | |
console.log('not in mini app'); | |
}, | |
invoke: { | |
id: 'notInMpThenWait', | |
src: () => Promise.resolve(), | |
onDone: { | |
target: 'isInMiniApp', | |
}, | |
onError: { | |
target: 'notInMiniApp', | |
}, | |
}, | |
}, | |
}, | |
onDone: 'testFinished', | |
on: { | |
KILL_APP: 'notInApp', | |
HOME: 'notInApp', | |
GO_TO_APP: 'notInApp', | |
}, | |
}, | |
testFinished: { | |
type: 'final', | |
}, | |
}, | |
}, | |
{ | |
actions: {}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment