browser-communication
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

browser-communication

This is a helper for communicating two or more browser tabs.

usage

There is two functions exported that you can use;

import { Data, fromStorage, publishStorage } from 'browser-communication';
 
interface User extends Data {
  id: number;
  username: string;
}
 
fromStorage<User>('user').subscribe(user => {
  // when someone calls publishStorage this 
  // this callback will be executed
  // local publishes are included though
});
 
publishStorage('user', {
  id: 3,
  username: 'john_doe'
});

Package Sidebar

Install

npm i browser-communication

Weekly Downloads

3

Version

1.0.2

License

ISC

Unpacked Size

15.8 kB

Total Files

12

Last publish

Collaborators

  • htevfik