@peetertomberg/registry
v1.0.3
Published
Basically a library to create a typed key-value store with an event emitter.
Downloads
2
Readme
registry
Basically a library to create a typed key-value store with an event emitter.
Install
npm install @peetertomberg/registry
Usage
import { createRegistry } from '@peetertomberg/registry';
const registry = createRegistry<String>();
const callback = (...args) => console.log(...args);
// Triggered when a key is registered
registry.eventBus.on(registry.events.REGISTER, callback);
// Triggered when a key is unregistered
registry.eventBus.on(registry.events.UNREGISTER, callback);
registry.register('key', 'value');
registry.unregister('key');