Skip to content

Instantly share code, notes, and snippets.

Avatar

Sebastian Carlsson sebastiancarlsson

View GitHub Profile
View machine.js
const EVENTS = {
// User action
CHANGE_TAB: 'change_tab',
PREV_STEP: 'prev_step',
NEXT_STEP: 'next_step',
UPDATE_SETTING: 'update_setting',
UPDATE_NAME: 'update_name',
CREATE_CUSTOM_EXPERIMENT: 'create_custom_experiment',
CREATE_EXPERIMENT_WITH_SETTINGS: 'create_experiment_with_settings',
CANCEL: 'cancel'
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
const todoMachine = Machine({
initial: 'pending',
context: {
description: 'This is my todo'
},
states: {
pending: {
on: {
DONE: 'done',
View machine.js
const trafficLightMachine = Machine({
initial: 'green',
states: {
green: {
on: {
TICK_EVENT: 'yellow'
}
},
yellow: {
on: {