8000 GitHub - jlgrall/minivents: Small event system for javascript · GitHub
[go: up one dir, main page]

Skip to content
jlgrallPublic
forked from allouis/minivents

About

Small event system for javascript

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

94 Commits

Folders and files

Repository files navigation

minivents

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

API

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

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

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

trigger is no longer supported!!

:%s/myobj.trigger(/myobj.emit(/ should do the trick in VIM

Example

var sandbox = new Event
58FE
s();

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

About

Small event system for javascript

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0