@devinle/sonar

1.0.24 • Public • Published

Sonar

A lightweight PubSub utility.

npm NPM GitHub last commit

Install

npm install @devinle/sonar

Usage

import { sonar } from 'sonar';

// Make a callback function
const callback = data => {};

// Register a callback with an event
// This event can receive data
sonar.on('evt', callback);

// Remove a specific callback from an event
sonar.off('evt', callback);

// Remove an entire event and all associated callbacks
sonar.off('evt');

// Trigger an event and send a payload object
sonar.trigger('evt', {...});

Tests

yarn test

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @devinle/sonar

Weekly Downloads

2

Version

1.0.24

License

MIT

Unpacked Size

198 kB

Total Files

7

Last publish

Collaborators

  • devinle