Skip to content
/ shared Public

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

License

Notifications You must be signed in to change notification settings

Codpoe/shared

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published