JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2848
  • Score
    100M100P100Q112592F
  • License ISC

Registry for callbacks

Package Exports

  • callback-registry

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 (callback-registry) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

callback-registry

Registry for callbacks

A simple registry that allows you to add one or more callbacks, where each callback is added with some key and then execute all callbacks by just using the key.

Similar to EventEmitter but not limited to Node.js.

const callbackRegistry = require('callback-registry');
const registry = callbackRegistry();

// add a new callback for that event key
registry.add('event-key', function(){
    console.log('the event occurred')
});

registry.execute('event-key');