-
• #2
There's some rough documentation at https://github.com/espruino/Espruino/blob/master/scripts/common.py#L61 and https://github.com/espruino/Espruino/blob/master/README_BuildProcess.md#wrapper-files-
Basically if you write an extension they are functions that hook into Espruino itself.
init
runs when the JS environment starts (eg. power on, reset, load)kill
is when is shuts downidle
is basically once every time around the event loop
-
• #4
Just one more thing about firing the events from the lib, like Bangle.on('mag'...)
I guess events are triggering "type" : "idle", where the associated 'C' method [like jswrap_puck_idle(), jswrap_banglejs_idle() ]checks if any event is available once every time around the event loop and call * jsiQueueObjectCallbacks();*.
Or there is something more or else that I am missing.
-
• #5
No, that's about it.
jswrap_puck_idle
basically checks/queues/even performs any events that are needed.It'll return
true
if the device shouldn't sleep after that iteration of the loop (eg maybe there is a queues event that should be executed)
What is the significance of the below jswrapper connect section, with type = init. Although Event and static method definitions are pretty much fine.
I am not able to find much information but this Espruino documentation page
EDIT: Similarly Type: kill/idle