New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jvent

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jvent

An universal JavaScript Emitter based on NodeJS EventEmitter.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
618
decreased by-57.26%
Maintainers
1
Weekly downloads
 
Created
Source

jvent.js NPM version License Build status Coverage Status Dependency status devDependency status downloads

An universal JavaScript Emitter based on NodeJS EventEmitter.

Installation

$ npm install jvent

$ bower install jvent

Standalone

Also, you can use the standalone version without components.

<script src="../dist/jvent.js"></script>

How-to

First, requires Jvent:

var Jvent = require('jvent');

Creates a new instance:

var emitter = new Jvent();

Now, defines a listener:

function listener(arg1, arg2) {
    alert(arg1 + ' '+ arg2);
})

Then, adds a new event live with a listener:

emitter.on('live', listener);

Emitsthe event with some data:

emitter.emit('live', 'param1', 'param2');

API

Jvent#on(event, listener)

Adds a listener to the collection for a specified event.

  • event - The name of the event you want to add.
  • listener - Listener you want to add from given event.
emitter.on('live', listener);

Jvent#once(event, listener)

Adds a one time listener to the collection for a specified event. It will execute only once.

  • event - The name of the event.
  • listener - Listener you want to add from the given event.
emitter.once('live', listener);

Jvent#off(event, listener)

Removes a listener from the collection for a specified event.

  • event - The name of the event.
  • listener - Listener you want to remove from the given event.
emitter.off('live', listener);

Jvent#removeAllListeners(event)

Removes all listeners from the collection for a specified event.

  • event - The name of the event you want to remove.
emitter.removeAllListeners('live');

Jvent#listeners(event)

Returns all listeners from the collection for a specified event.

  • event - The name of the event.
emitter.listeners('live');

Jvent#emit(event, [arg1], [arg2], [...])

Execute each of the listeners collection in order with the given parameters. All emitters emit the event newListener when new listeners are added.

  • event - The name of the event you want to emit.
emitter.emit('live', 'data1', 'data2');

With :heart: by

License

MIT license. Copyright © 2016 @pazguille.

Keywords

FAQs

Package last updated on 16 Dec 2016

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