Skip to content

Instantly share code, notes, and snippets.

@UberMouse
Created January 30, 2020 03:55
Show Gist options
  • Save UberMouse/2df2809492350b9b86b287d0cd38c6fa to your computer and use it in GitHub Desktop.
Save UberMouse/2df2809492350b9b86b287d0cd38c6fa to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const RepositoryMachine = Machine({
key: "repository",
initial: "noRepositorySelected",
states: {
noRepositorySelected: {
on: {
REPOSITORY_SELECTED: {
target: "viewingChanges",
actions: assign({
selectedRepository: (_ctx, event) => event.repository
})
}
}
},
viewingChanges: {
on: {
HISTORY_SELECTED: "viewingHistory"
},
states: {
noLayerSelected: {
on: {
LAYER_SELECTED: {
target: "layerSelected",
actions: assign({
selectedLayer: (_ctx, event) => event.layer
})
}
}
},
layerSelected: {}
}
},
viewingHistory: {
on: {
CHANGES_SELECTED: "viewingChanges"
},
states: {
noCommitSelected: {
on: {
COMMIT_SELECTED: {
target: "commitSelected",
actions: assign({
selectedCommit: (_ctx, event) => event.commit
})
}
}
},
commitSelected: {}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment