Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minivents

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minivents

Tiny eventing for javascript

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
489
increased by41.33%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 20 Dec 2013

Did you know?

Socket

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc