I read the docs on E.on('init') here http://www.espruino.com/Reference#l_E_init and I'm not getting "it". If I write a JavaScript, surely the script runs at line 1 onwards and hence if I wanted initialization functions, I would explicitly execute them from my script?
Now, if I was to "guess" what is going on, what we are saying here is that E.on('init') causes functions to be registered which are saved in the "state" when a JavaScript program is saved to flash and are run when it is load from flash? Is that close to being correct?
If so, I think we need a page of documentation (if it doesn't already exist) that describes the philosophy of save and load of programs and the state that is maintained. This would then want to be referenced in the docs for E.on('init').
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I read the docs on
E.on('init')
here http://www.espruino.com/Reference#l_E_init and I'm not getting "it". If I write a JavaScript, surely the script runs at line 1 onwards and hence if I wanted initialization functions, I would explicitly execute them from my script?Now, if I was to "guess" what is going on, what we are saying here is that
E.on('init')
causes functions to be registered which are saved in the "state" when a JavaScript program is saved to flash and are run when it is load from flash? Is that close to being correct?If so, I think we need a page of documentation (if it doesn't already exist) that describes the philosophy of save and load of programs and the state that is maintained. This would then want to be referenced in the docs for
E.on('init')
.