Skip to content

Instantly share code, notes, and snippets.

@dhargitai
Last active October 16, 2020 11:40
Show Gist options
  • Save dhargitai/ffd0b5369ef82b1457d2a6716cf67505 to your computer and use it in GitHub Desktop.
Save dhargitai/ffd0b5369ef82b1457d2a6716cf67505 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const iqrsDeviceMachine = Machine({
id: 'device',
initial: 'unknown',
context: {
recordingType: 'boundary'
},
states: {
unknown: {
on: {
EXPECT: 'expected',
}
},
expected: {
on: {
CONNECT: 'standBy',
}
},
standBy: {
on: {
START_BOUNDARY_RECORDING: 'recordingBoundary',
START_PASSAGE_RECORDING: 'recordingPassage',
EXCEPTION: 'problem',
WORK: 'working',
CHARGE: 'charging',
}
},
recordingPassage: {
on: {
STOP: 'standBy',
EXCEPTION: 'problem',
}
},
recordingBoundary: {
on: {
STOP: 'standBy',
EXCEPTION: 'problem',
}
},
charging: {
on: {
WORK: 'working',
STOP: 'standBy',
EXCEPTION: 'problem',
}
},
working: {
on: {
CHARGE: 'charging',
STOP: 'standBy',
EXCEPTION: 'problem',
}
},
problem: {
on: {
RESOLVE: 'standBy',
REJECT: 'expected',
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment