This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

cadienvan-event-bus

1.1.2 • Public • Published

What is this?

This is a simple event bus made using the CustomEvent Web API for in-browser usage simulating the Node.js EventEmitter API.

How to use it?

Simply import the module and start using it as follows:

import ee from 'cadienvan-event-bus/index.mjs';
ee.on('event', (data) => console.log(data));
ee.emit('event', 'Hello World!');
ee.off('event');

If you prefer a simpler approach, you could just import the index.js file in your HTML as a script tag and use the global eventBus variable:

eventBus.on('event', (data) => console.log(data));
eventBus.emit('event', 'Hello World!');
eventBus.off('event');

Readme

Keywords

none

Package Sidebar

Install

npm i cadienvan-event-bus

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

1.63 kB

Total Files

4

Last publish

Collaborators

  • cadienvan