SimonGAndrews / xstate-fsmPlus-Espruino

Fork of the FSM finite state machine package in the XState library from STATELY Ai, to enable the FSM to be run as a module within the Espruino JavaScript Interpreter for Microcontrollers. Providing enhancements to enable some basic StateChart features to be supported (eg nested states).
MIT License
0 stars 0 forks source link

Execute State Actions - Exec not defined ? #10

Closed SimonGAndrews closed 2 years ago

SimonGAndrews commented 2 years ago

The following error occurs when running test_basicInterpreter.

image

SimonGAndrews commented 2 years ago

image

Looks like original is destructuring out the exec property from each element of the state.actions array. Espruino does not like destructuring.

When executing this code state object looks like this (for example). Actions is an array of action objects each with type and exec properties. image

The following mod uses object.assign to create an action object from the action array element. image

note also as per original , in the mod:

SimonGAndrews commented 2 years ago

The above mode passes regression tests and enables execution in Espruino.