Tabs broadcast system.
This package allows you to communicate arbitrary data between browser tabs, as well as transfer events between them. This solution is supported in Chrome, Firefox and Opera. The exact version support can be found in caniuse.com
Install
Using npm
npm install tabs-broadcast
Using yarn
yarn add tabs-broadcast
Use plugin (ES6)
Return the class that you want to initialize
Methods
.$emit( message: {String}, data: {String} )
- sends any event with arbitrary data to the browser
.$on( message: {String}, callback: {Function} )
- listens for events within the browser
.$once( message: {String}, callback: {Function} )
- listens for events within the browser. Deletes the subscription to the event after a call to callback
.$off( message: {String} )
- unsubscribes from wiretapping events of the specified method
Example
// Written in a file that handles authorization TabsBroadcast // It is written in the file that causes authorizationTabsBroadcast // Will cause a colback and remove the listener. Will be executed only onceTabsBroadcast // Removes a listenerTabsBroadcast