JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q45148F
  • License MIT

Single purpose emitter

Package Exports

  • @hooked74/single-purpose-emitter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hooked74/single-purpose-emitter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Single Purpose Emitter

Build Status npm License Codecov Module Size

Install

npm install @hooked74/single-purpose-emitter

Usage

// initialize
const emitter = new SinglePurposeEmitter();

// attach handlers
const handler1 = () => console.log("handler 1");
emitter.attach(handler1);
emitter.attach((value) => console.log("handler 2", value));

// dispatch
emitter.emit("some value");

// output:
// handler 1
// handler 2 some value

// detach specific handler
emitter.detach(handler1);

// detach all handlers
emitter.detach();