node package manager

min-evt

mini-evt


NPM version spm version Build Status Coverage Status

A mini event module.


INSTALL

via spm:

$ spm install mini-evt --save

via npm:

$ npm install mini-evt --save

USAGE

var Event = require('mini-evt');
 
var evt = new Event();
evt.on("event-name", function(arg0, arg1){
  // Do somethings. 
});
evt.emit("event-name", "arg0", "arg1");

API

event.on(String eventName, Function handler)

Binding event name with handler.

event.off([String eventName], [Function handler])

Unbinding event name with handler.

  • String eventName: optional, if without eventName, unbinding all of the handler in instance of mini-evt.
  • Function handler: optional, if without handler argument, unbinding all of the handlers named argument eventName.