Answers for "method of the events module that performs the function only the first time the event occurs node js"

6

node js event emitter

const EventEmitter = require('events');

class MyEmitter extends EventEmitter {
  foo() {
    this.emit('test');
  }
}
const myEmitter = new MyEmitter();
myEmitter.on('test', () => console.log('Yay, it works!'));

myEmitter.foo();	// Yay it works!
Posted by: Guest on October-29-2020

Code answers related to "method of the events module that performs the function only the first time the event occurs node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language