minivents
TypeScript icon, indicating that this package has built-in type declarations

2.2.1 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.2.1
    250
    • latest

Version History

Package Sidebar

Install

npm i minivents

Weekly Downloads

435

Version

2.2.1

License

MIT

Unpacked Size

16.1 kB

Total Files

15

Last publish

Collaborators

  • allouis