npm.io
0.0.1 • Published 10 years ago

evn

Licence
MIT
Version
0.0.1
Deps
0
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

evn

Manage events in JavaScript

npm npm

Installation

npm install --save evn

API

evn.add(id, callback, scope)

Add a new event listener.

id

A string withe the event ID.

callback

The function that will be executed when the event is executed.

scope

The value of this where the callback will be executed.

evn.send(id[, args])

Emit an event.

id

The event ID that will be executed.

args (optionally)

Arguments for the callback.

Example

//Import dependencies
var evn = require('evn');

//Add a new event
evn.add('say_hello', function(name){ console.log('Hello ' + name + '!!'); });

//Call the event
evn.send('say_hello', 'Susan'); // -> Hello Susan!!

License

MIT LICENSE

Keywords