Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Alternative event lib
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
LICENSE
README.md
occur.js
package.json

README.md

Occur

Occur event is an implementation of w3c-like events.

Example

Example with inheritance.

var Occur = require('occur');
var utils = require('utils');

function SomeHandler() {
    Occur.call(this);
}

utils.inherits(SomeHandler, Occur);

var handler = new SomeHandler();
handler.on('handle', function(e) {
    console.log(e.type, e.value, e.target === handler);
});

// Trigger events
handler.trigger({type : 'handle', value : 1});
// --> handle 1 true
handler.trigger('handle');
// --> handle undefined true
handler.trigger(new Occur.Event('handle', {value: 2}));
// --> handle 2 true
Something went wrong with that request. Please try again.