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

zemitter

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zemitter

Advanced event emitter for node and the browser

  • 0.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

zemitter

Flexible Event Emitter for Node and the Browser

Install

$ npm install zemitter

Usage

var Emitter = require('zemitter')
var obj = {}

//either make an object become an event emitter
Emitter(obj) // returns obj

//or create a brand new emitter
var emitter = Emitter()

Example

emitter.on({
    start: function(greeting, name){
        console.log(greeting, name)
    },
    stop: function(){

    },
    scope: {}
})
emitter.on('start', function(){

})
emitter.on({
    start: {
        fn: function(){

        },
        scope: ''
    },
    stop: function(){}
})

emitter.emit('start', 'hello', 'world')

API

on

emitter.on({
    'event_name': fn
})
emitter.on(['start','stop','exit'], fn)
emitter.on(['start','stop','exit'], [fn1, fn2])

off

emitter.off('start', fn)// remove fn as a listener to the 'start' event emitter.off('start') // remove all listeners to the start event emitter.off() // remove all listeners attached to this emitter

once

Attach a function that will only be called once, and then will be removed from the emitter

Tests

$ make

License

MIT

Keywords

FAQs

Package last updated on 12 Nov 2014

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