...sometimes users ask for killer app - in this case: killer function - that turns out to be a (potential) product killer feature. There are too many dependencies that are not necessarily understood to blindly apply save() anytime. I'm with @fanoush on that, because the system state may be in a non-resumable state, and more so, when peripherals have initializations as well, it is good practice to put all initializations into an onInit() triggered path. I know that Espruino does a good job in restoring pin modes and one time initializations of its (communication) appliances, such as assigning pins and modes and speeds, etc. But that's about it. I allow myself to save those. But for me, any xyz.connect() or a like and object initializations belong into the onInit() triggered path. If this save() function poses too much risk() - as experience over time may indicate - only save on send should survive, because it ensures that nothing has run yet.
© Espruino, powered by microcosm.
Report a problem