Skip to content

Instantly share code, notes, and snippets.

@mindrones
Created November 13, 2020 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindrones/92cf64f23b3c353da3839bc0dfd084a0 to your computer and use it in GitHub Desktop.
Save mindrones/92cf64f23b3c353da3839bc0dfd084a0 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine({
"id": "ExploreRoute",
"initial": "Interactive",
"on": {},
"states": {
"Interactive": {
"type": "parallel",
"states": {
"History": {
"initial": "Idle",
"states": {
"Idle": {
"on": {
"EDITED": {
"target": "Idle",
"actions": "updateEntry"
}
}
}
}
},
"Selecting": {
"initial": "Idle",
"states": {
"Idle": {
"entry": [
"logEvent"
],
"on": {
"SELECTED_FIELDS": {
"target": "Idle",
"actions": [
"selectFields",
"sendEdited"
]
},
"CLICKED_FIELD_COUNTER": {
"target": "Idle",
"actions": [
"toggleField",
"sendEdited"
]
},
"SELECTED_NEXT_FIELD": {
"target": "Idle",
"actions": [
"selectNextField",
"sendEdited"
]
},
"SELECTED_PREVIOUS_FIELD": {
"target": "Idle",
"actions": [
"selectPreviousField",
"sendEdited"
]
}
}
}
}
}
},
"on": {
"DATASET_UPDATED": {
"target": "#ExploreRoute.Interactive",
"actions": [
"storeDataset"
]
}
}
}
}
}, {
"actions": {
"logEvent": {
"type": "xstate.log",
"label": "logEvent",
"expr": (context, event) => `event: ${stringify(event)}, context: ${stringify(context)}`
},
"storeDataset": {
"type": "xstate.assign",
"assignment": (ctx, {project, source, version}) => {
ctx.dataset.set({project, source, version});
return ctx;
}
}
},
"guards": {}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment