npm.io
1.5.16 • Published 2 months ago

@local-logic/channel

Licence
—
Version
1.5.16
Deps
2
Size
31 kB
Vulns
0
Weekly
0

Channel

This module defines a 'Channel', built upon the CustomEvent API. This abstraction provides a simple, Promise-based way for managing async events.

A Channel assumes two nodes: a Leader and a Follower. The Leader is instantiated first, and its 'connection' Promise will resolve only when the Follower has suscessfully connected.

When a connection is established, events can be freely sent to and from each Node, thereby creating a Channel!