Socket
Book a DemoInstallSign in
Socket

@1k/emitter

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
Package was removed
Sorry, it seems this package was removed from the registry

@1k/emitter

A tiny event emitter

0.0.13
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@1k/emitter

A tiny (less than 1k) event emitter.

Install

npm

npm install @1k/emitter --save

Usage

var Emitter = require('@1k/emitter');
var emitter = new Emitter();

emitter.on('some-event', function (arg1, arg2, arg3) {
 //
});

emitter.emit('some-event', 'arg1 value', 'arg2 value', 'arg3 value');

Instance Methods

on(event, cb[, ctx])

Subscribe to an event

  • event - the name of the event to subscribe to
  • cb - the function to call when event is emitted
  • ctx - (OPTIONAL) - the context to bind the event cb to

once(event, cb[, ctx])

Subscribe to an event only once

  • event - the name of the event to subscribe to
  • cb - the function to call when event is emitted
  • ctx - (optional) - the context to bind the event cb to

off(event[, cb])

Unsubscribe from an event or all events. If no cb is provided, it unsubscribes you from all events.

  • event - the name of the event to unsubscribe from
  • cb - the function used when binding to the event

emit(event[, arguments...])

Trigger a named event

  • event - the event name to emit
  • arguments... - any number of arguments to pass to the event subscribers

License

MIT

Keywords

1k

FAQs

Package last updated on 14 Oct 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.