just-event-bus Svelte Themes

Just Event Bus

Simple Event bus compatible with React.js/Vue.js/Svelte/anything else

Simple Event Bus for javascript that just works

Installation

npm install just-event-bus

Usage

import EventBus from 'just-event-bus'

const fn = (text) => console.log(text);
EventBus.on("foo", fn);

EventBus.emit("foo", "Hello World!"); // => Hello World!

Also it supports arrays:

import EventBus from 'just-event-bus'

const fn = (text) => console.log(text);
EventBus.on(["foo", "bar"], [fn]);

EventBus.emit("foo", "Hello!"); // => Hello!
EventBus.emit("bar", "World!"); // => World!

Top categories

Loading Svelte Themes