Last active
February 20, 2020 15:03
-
-
Save rjdestigter/9d1cad1b963831913e7ffabcebdd8f67 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 valueInput = id => ({ | |
initial: "empty", | |
states: { | |
empty: { | |
on: { | |
[`${id}.LOCK`]: { | |
target: "locked", | |
actions: send('STEP') | |
} | |
} | |
}, | |
valid: {}, | |
locked: { | |
on: { | |
// '': { actions: 'STEP' } | |
} | |
} | |
} | |
}) | |
const fsCalcMachine = Machine({ | |
id: "fsCalc", | |
initial: "calculating", | |
context: { | |
solvingFor: "unknown" | |
}, | |
states: { | |
fullyDefined: {}, | |
calculating: { | |
on: { | |
DONE: { | |
target:'fullyDefined', | |
cond: (_, e) => e.value === true | |
} | |
}, | |
type: 'parallel', | |
states: { | |
result: { | |
initial: 'zero', | |
states: { | |
zero: { | |
on: { STEP: 'one' }, | |
}, | |
one: { | |
on: { STEP: 'two' }, | |
}, | |
two: { | |
type: 'final', | |
on: { STEP: { | |
actions: send({ type: 'DONE', value: true }) | |
} }, | |
} | |
} | |
}, | |
feedrateInput: valueInput('feedrateInput'), | |
chiploadInput: valueInput('chiploadInput'), | |
numFlutesInput: valueInput('numFlutesInput'), | |
spindleSpeedInput: valueInput('spindleSpeedInput'), | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment