Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Nov 25, 2021
1 parent 701551f commit 6152ccf
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Useful for loaders, components bootstrap, geo position updates, and all other as
* **Breaking**
* removed `new` method; the export now is `broadcast` and the `Broadcast` class
* changed `when` signature; it now always returns a *Promise*
* no transpilation anymore, usable by ES2015+ compatible engines
* **New**
* smaller
* faster
Expand All @@ -27,6 +28,8 @@ Useful for loaders, components bootstrap, geo position updates, and all other as
### Examples

```js
import {broadcast} from 'broadcast';

// as Promise,
// inspired by customRegistry.whenDefined(...).then(...)
// will you ever ask for a geo position or
Expand Down Expand Up @@ -105,13 +108,7 @@ button.addEventListener('click', e => {
#### private broadcasts
There are two different ways to have a private broadcasts:

* using a secret `type` as channel, like in `broadcast.when(privateSymbol).then(log)`
* create a local version of the notifier that will share nothing with the main one:
`const pvt = broadcast.new();`
* using a secret `type` as channel, like in `broadcast.when(privateSymbol)`
* create an instance a part via `import {Broadcast} from 'broadcast';` and `const bc = new Broadcast;`

The first way enables shared, yet private, resolutions while the second one would be unreachable outside its scope.


## Compatibility
This library is compatible with every JS engine since ES3, both browser and server,
but a `Promise` and a `Map` polyfill might be needed in very old engines.

0 comments on commit 6152ccf

Please sign in to comment.