Created
September 23, 2019 16:18
-
-
Save Baael/01a129dbb4cfe354e9bae6c4aae9c564 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
const machine = Machine({ | |
id: 'fetch', | |
initial: 'idle', | |
states: { | |
idle: { | |
type: 'atomic', | |
on: { | |
FETCH: 'pending' | |
} | |
}, | |
pending: { | |
type: 'parallel', | |
states: { | |
resource1: { | |
type: 'compound', | |
initial: 'pending', | |
states: { | |
pending: { | |
on: { | |
'FULFILL.resource1': 'success' | |
} | |
}, | |
success: { | |
type: 'final' | |
} | |
} | |
}, | |
resource2: { | |
type: 'compound', | |
initial: 'pending', | |
states: { | |
pending: { | |
on: { | |
'FULFILL.resource2': 'success' | |
} | |
}, | |
success: { | |
type: 'final' | |
} | |
} | |
} | |
}, | |
onDone: 'success' | |
}, | |
success: { | |
type: 'compound', | |
initial: 'items', | |
states: { | |
items: { | |
on: { | |
'ITEM.CLICK': 'item' | |
} | |
}, | |
item: { | |
on: { | |
BACK: 'items' | |
} | |
}, | |
hist: { | |
type: 'history', | |
history: 'shallow' | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment