Socket
Socket
Sign inDemoInstall

minivents

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    minivents

Tiny eventing for javascript


Version published
Weekly downloads
321
decreased by-35.54%
Maintainers
1
Install size
6.90 kB
Created
Weekly downloads
 

Readme

Source

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 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

Keywords

FAQs

Last updated on 10 Jul 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc