Skip to content

lxsmnsyc/bs-broadcast-channel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bs-broadcast-channel

ReasonML bindings for Broadcast Channel

NPM

Install

npm

npm i --save bs-broadcast-channel

yarn

yarn add bs-broadcast-channel

After installing, add it to the dependencies

bsconfig.json

{
  "bs-dependencies": [
    "bs-broadcast-channel",
  ],
}

Usage

open BsBroadcastChannel;

/**
 * Create a channel
 */

let channel = BroadcastChannel.make("My app");

/**
 * Listen to messages
 */
channel->BroadcastChannel.addEventListener("message", (data: MessageEvent.t) => {
  /**
   *  get our data
   */
  Js.log(data->MessageEvent.data);
});

/**
 * Post message
 */
channel->BroadcastChannel.postMessage("Hello World");

/**
 * Close our channel
 */
channel->BroadcastChannel.close();

License

MIT © lxsmnsyc

About

ReasonML bindings for Broadcast Channel API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published