node package manager


Event helper for browser

@version  0.4.0
@date     2016-01-14


Event.Emitter can be mixed in to any object, giving the object the ability to emit named events.

Mix Event.Emitter to custom object.

function MyObj(name) { = name
Object.assign(MyObj.prototype, Event.Emitter)
var obj = new MyObj("obj1")
obj.on("say", function(text) {
    console.log( + " says: " + text)
obj.emit("say", "hello world")

Use in Mediator Pattern.

// Define global mediator 
var Mediator = Object.create(Event.Emitter)
// Listen login events in login controller 
Mediator.on("login", function(user, pass) {
    // login code 
// Emit login event from login view 
Mediator.emit("login", "username", "secretPassword")

Attach listeners to DOM events

function hi(){
    // alert just once 
    Event.remove(el, "click", hi)
var el = document.getElementById("foo")
Event.add(el, "click", hi)
// handle also touch events 

Copyright (c) 2013-2015 Lauri Rooden <>
The MIT License