1.0.2 • Published 4 years ago

browser-communication v1.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

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'
});