Skip to content
/ what-bus Public

An event-bus based on the WHATWG's BroadcastChannel API

License

Notifications You must be signed in to change notification settings

jabr/what-bus

Repository files navigation

what-bus

An event-bus based on the WHATWG's BroadcastChannel API.

The core module is a basic framework for creating, caching and clean-up of the underlying channel instances.

The cluster module is currently a work-in-progress, with the goal of coordination in a cluster of distributed WhatBus instances. Some implemented, partially complete, and planned features:

Example

import WhatBus from "./core.ts"
const wb = new WhatBus('wb:')

let s1 = wb.subscribe('t:1', event => console.log('s1', event.data))
wb.subscribeOnce('t:1', /* ... */)

wb.publish('t:1', { m: 100 })
wb.close()

import { create } from "./cluster.ts"
const wb = await create('twb:')
// @todo: cluster examples

References

License

This project is licensed under the terms of the MIT license.

About

An event-bus based on the WHATWG's BroadcastChannel API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published