Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

emitter-context

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emitter-context

Same as node Events with support for handler context

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

emitter-context

This is a "fork" of node's Events module with support for specifying a context for the handler

API

Everything is the same as Events except:

emitter.addListener(event, listener, [ context ])

emitter.on(event, listener, [ context ])

emitter.once(event, listener, [ context ])

If the context is not specified, this (the emitter) will be used as the context.


var Emitter = require('emitter-context')
  , x = new Emitter()
;

var context = { foo: 'bar' };

x.on('baz', function () {
    console.log(this.foo);
}, context);

x.emit('baz');
// true - There are listeners for `baz`
// 'bar'

Keywords

context

FAQs

Package last updated on 26 Jan 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