@toolman/shared
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

shared

A simple library for creating something shared where you can use events and mount anything you like.

Install

yarn add @toolman/shared

Usage

import shared from '@toolman/shared';

const host = shared();

// `on` & `emit`
// Note: `once`, `off` are also supported 
host.on('msg', payload => {
  console.log(payload); // => 'cool'
});

host.emit('msg', 'cool');


// `set` & `get`
host.set('foo', 'bar');

(async () => {
  await host.get('foo'); // => 'bar'
})();

That's all.

Readme

Keywords

none

Package Sidebar

Install

npm i @toolman/shared

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

19.7 kB

Total Files

10

Last publish

Collaborators

  • codpoe