TypeScript message passing (broadcasting) library.
npm install tabcast
TypeScript message passing (broadcasting) across multiple tabs of same origin.
Tabcast is available on npm, you can install it with either npm or yarn:
``sh`
npm install tabcastor:
yarn install tabcast
`ts
import Tabcast from 'tabcast';
const cast = new Tabcast(); // or new Tabcast('channel');
cast.on('message', (message: any) => {
console.log(message);
});
cast.broadcast('Hello, world!');
`
Emitted when a valid message is received.
The only argument contains an object of type T with a deserialized message.
`
on(eventType: 'message', listener: (message: T) => void);
off(eventType: 'message', listener: (message: T) => void);
constructor(private channel: string);
broadcast(message: T);
``