SimonGAndrews / xstate-fsm-Espruino

fork of the finite state machine (FSM), XState/fsm, with modifications necessary to run it as a module within the Espruino JavaScript Interpreter for Microcontrollers
MIT License
0 stars 0 forks source link

Espruino alternative for function.name (used in function toActionObject() ) #13

Open SimonGAndrews opened 3 years ago

SimonGAndrews commented 3 years ago

Espruino does not seem to support function.name to return the name property of a function.
This gives an issue in the function toActionObject() , in that the type of a function action is always 'undefined'. May not be a show stopper as xstate/fsm behaves similiarly when multiple actions are defined within an array in the machine definition. Further testing required.

image

SimonGAndrews commented 3 years ago

Investigation of an alternative pattern in Espruino is ongoing, raised a question on Espruino forum. Alternative methods/Polyfills investigated to date rely on parsing the result of function.toString. Unfortunatley Espruino does not put the function name into the function.toString() output.
Continuing to test impact.

opichals commented 2 years ago

Function.name is indeed not supported (yet?) - https://github.com/espruino/Espruino/issues/1348