Quick Start Best Practices - Proper way to call init() on start up - E.on() - onInit() - delayed start - Sample code usage examples #1224
Replies: 3 comments
-
Posted at 2020-01-18 by @MaBecker this is what I use now:
Edit: added missing curly bracket open in line 12 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-01-19 by @allObjects ...opening curly brace - in line 12 - fell victim to the experience that allows writing code top of your head without testing... (EDIT: obviously fixed now). I like this variable option. Put it as a single line with (could not let go my 'Schnapszahl'):
I use a similar approach for my debugging, logging:
In (my) emulation I have an overwrite that logs way much more... It is always a good approach to keep code changes the smallest between dev and release... last but not least also to be able to fall back in case debug is needed without having to change code but just the value of a variable. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-01-19 by Robin Sun 2020.01.19
And we now have a practical working example solution using the Ternary operator
*explanation and examples*
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-01-18 by Robin
Fri 2020.01.17
While I can not take any credit for these examples, having a launching point is needed to save precious moments supporting our Espruino community.
These individuals were cranking out init code solutions two years before I could spell Espruino:
@ollie post #2
@mabe post #3
@gordon post #4
@allObjects post #8 his 0.02 worth
and a must read post #18 two more 0.02 worth
> EDIT: See @mabe solution in #2 post to conditionally select during development
The basic idea:
An excellent read with usage examples, the entire article:
*a must read* explanation > http://www.espruino.com/Saving
and another @allObjects gem
Beta Was this translation helpful? Give feedback.
All reactions