minivents

by allouis

allouis / minivents

✨JavaScript events in 355 Bytes✨

413 Stars 41 Forks Last release: Not found MIT License 128 Commits 12 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

minivents Build Status

http://allouis.github.io/minivents/

API

on
: Listen to event. Params { type:
String
, callback:
Function
| context:
Object
}. Returns
target
.

off
: Stop listening to event. Params { type:
String
| callback:
Function
}. Returns
target
.

emit
: Emit event. Params { type:
String
| data:
Object
}. Returns
target
.

Constructor Example

var sandbox = new Events();

sandbox.on("event", function(){ // do stuff });

sandbox.emit("event"); //does stuff

sandbox.off("event");

sandbox.emit("event"); //does not do stuff

Mixin Example

var sandbox = {
    otherStuff: true
};

Events(sandbox);

sandbox.on("event", function(){ // do stuff });

sandbox.emit("event"); //does stuff

sandbox.off("event");

sandbox.emit("event"); //does not do stuff

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.