Are you saying that you can define multiple callbacks with the xxx.on(...) type handlers?
The others have said, but yes (same with Serial.on('data',...) too). You can use .removeAllListeners('init') to remove. There should be a specific one too, but I never implemented that :)
The other cool thing this would allow is for modules like the ones for LCD to auto-initialise themselves, so you no longer need to explicitly initialise them at all.
@the1laz - yes, more events in future would be great.
It'd be nice to have a way to handle other events in an extensible way - for instance Capture/compare timers or stuff like that.
@tve - Yes, I was wondering about that as well. I think it's work a separate post - I just added one
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.
Ok, great! Looks like a consensus -
E
it is.The others have said, but yes (same with
Serial.on('data',...)
too). You can use .removeAllListeners('init') to remove. There should be a specific one too, but I never implemented that :)The other cool thing this would allow is for modules like the ones for LCD to auto-initialise themselves, so you no longer need to explicitly initialise them at all.
@the1laz - yes, more events in future would be great.
It'd be nice to have a way to handle other events in an extensible way - for instance Capture/compare timers or stuff like that.
@tve - Yes, I was wondering about that as well. I think it's work a separate post - I just added one