Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

event in node js

const EventEmitter = require('events')
const myEmitter = new EventEmitter();
myEmitter.emit('newSale') //give name 
//setup listener
myEmitter.on("newSale", ()=> {console.log("There was a new sale!")})
myEmitter.emit("newSale")
 
PREVIOUS NEXT
Tagged: #event #node #js
ADD COMMENT
Topic
Name
1+8 =