• In node/browser if I need to incorporate an event emitter I either use the native events module or third party. Typically I'd create a new class by extending the event emitter. Like so. https://nodejs.org/api/events.html

    import EventEmitter from 'events'
    class SomeClass extends EventEmitter {
      constructor() {

    but it seems that all (plain?) objects in Espruino have an event emitter baked in by default. https://www.espruino.com/Reference#l_Obj­ect_emit

    So when I make a new class or make an object like so I get an event emitter as well?

    Is the actual event emitter module available? If so where is that in the api docs

    const obj = {}
    class SomeClass {
      constructor() {
    const cls = new SomeClass()
    obj.on('test',  val => { console.log(val) })
    cls.on('test',  val => { console.log(val) })

Avatar for dgk @dgk started