Last active
August 30, 2021 04:59
-
-
Save michaelfig/f17a09d29905f966ce4e13318e1f076f 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
Machine({ | |
id: 'Agoric Wallet Iframe Connection', | |
initial: 'idle', | |
context: { | |
location: null, | |
connecting: false, | |
}, | |
states: { | |
idle: { | |
on: { | |
'': { | |
target: 'locating', | |
cond: context => { | |
return context.connecting; | |
}, | |
}, | |
}, | |
}, | |
locating: { | |
on: { | |
'': { | |
target: 'idle', | |
cond: context => !context.connecting, | |
}, | |
}, | |
}, | |
bridging: { | |
on: { | |
'': { | |
target: 'idle', | |
cond: context => !context.connecting, | |
}, | |
}, | |
}, | |
}, | |
on: { | |
'UPDATE.LOCATION': { | |
target: 'bridging', | |
actions: assign({ | |
location: (_, event) => event.value, | |
}), | |
cond: 'locationChanged', | |
}, | |
}, | |
guards: { | |
locationChanged: (context, event) => context.location !== event.value, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment