eventemt
v1.0.2
Published
[![Build Status](https://travis-ci.org/eyupinan/eventemt.svg?branch=master)](https://travis-ci.org/eyupinan/eventemt)
Downloads
6
Readme
Event Emitter
Install
The library is available as an npm package. To install the package run:
npm install eventemt
Usage
On
Add an event listener to support chained calls.
evnt.on(eventName,...args);
- EventName : name of event
- args : listener functions
once
Add an event listener that can only be triggered once
evnt.on(eventName,...args);
- EventName : name of event
- args : listener functions
remove
Delete an named event Listener
evnt.remove(eventName,func);
- eventName : name of event
- func : name of function as String
emit
Triggers event
evnt.emit(eventName,...args);
- eventName : name of event
- args : parameters for listeners
Example Code
var core = require('eventemt')
var evnt = new core.CoreObject()
function func1(param){
console.log(param);
}
var func2=function (param){
console.log(param);
}
evnt.on("message",func1,func2);
evnt.emit('message', 'Good Bye World')