@Gordon, the names used in the brief explanation / example is the issue... 'We' who are used to objects and the event emissioning and listening (as for example NodeJS has implemented it), the frugal examples are 'understood' / 'interpreted' the right way, last but not least the names are used all over the place in such environments and type and purpose of their elements/arguments are clear to us:
Just adding some comments already helps:
o.on("data",foo); // o: any object, "data": name/id of the event
o.on("data",bar); // foo,bar: listening functions, accepting 2nd... arg of .emit()
o.emit("data","Hallo"); // triggering listening functions passing one arg
There would be more to say, but your changes in doc make it understandable, and also the link to node js doc helps. A hint about what to search for would be even more helpful: Google / Search the web for 'node js emit on'
© Espruino, powered by microcosm.
Report a problem