You are reading a single comment by @AndreyVS and its replies. Click here to read the full conversation.
  • Hm.. For whatever reason, it works now.. I'm a bit embarrassed.. Just for reference, code is here:

    function aClass() {};
    aClass.prototype.testEmit = function() {
      setTimeout(()=>this.emit('TestEvent'), 1000); 
    var a = new aClass();
    a.on('TestEvent', ()=>console.log('Got event')); 
    a.testEmit();  // get 'Got event' printed in log
    var a1 = new aClass();
    a1.testEmit(); // event here is not caught

Avatar for AndreyVS @AndreyVS started