Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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!
Comment

PREVIOUS NEXT
Code Example
Javascript :: reset page js 
Javascript :: how to unselect input javascript 
Javascript :: descending order in objects in js 
Javascript :: datatables server side 
Javascript :: js create element 
Javascript :: cart page route in shopify 
Javascript :: javascript move element to coordinates 
Javascript :: javascript convert to array 
Javascript :: use get_json in jstree example 
Javascript :: javascript sort map by value 
Javascript :: repeat an array multiple times in js 
Javascript :: generate random string with javascript 
Javascript :: Node Sass version 7.0.0 is incompatible with ^4.0.0 
Javascript :: discord.js start code 
Javascript :: js find value in array 
Javascript :: sort in mongoose aggregate lookup 
Javascript :: spotify web player 
Javascript :: filter multidimensional array javascript 
Javascript :: vuetify autocomplete get input value 
Javascript :: polyfill for bind 
Javascript :: strpos in javascript 
Javascript :: how to destroy cookie in javascript 
Javascript :: jquery compare two arrays return difference 
Javascript :: primitive and non primitive data types in javascript 
Javascript :: function inside object javascript 
Javascript :: how to use saved image on react 
Javascript :: get url parameters javascript 
Javascript :: cubic root javascript 
Javascript :: A simple static file server built with Node.js 
Javascript :: how to check whether a string contains a substring in javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =