Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cross-tab-middleware

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-tab-middleware

Middleware to share actions between open tabs

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cross-tab-middleware

This is middleware that lets you opt in to sending actions across open browser tabs using cross-tab-channel.

Usage

1. Add it to your store

Pass crossTabMiddleware a string to identify and/or version your app.

Same Domain
import crossTabMiddleware from 'cross-tab-middleware';

store = createStore(
    reducer,
    applyMiddleware(
        thunk,
        createdRouterMiddleware,
        promiseMiddleware(),
        crossTabMiddleware('your-app-name')
    )
);
Cross Domain

To work across different domains, cross-tab-channel uses an iframe. That HTML file is entirely self contained and can be found in the cross-tab-channel repo. It has no requirements and can be hosted statically.

import crossTabMiddleware from 'cross-tab-middleware/crossDomain';

store = createStore(
    reducer,
    applyMiddleware(
        thunk,
        createdRouterMiddleware,
        promiseMiddleware(),
        crossTabMiddleware('//your-domain/path/to/iframe.html', 'your-app-name')
    )
);

2. Add crossTab: true to your actions

Let the middleware know you want this action to be sent to other tabs.

export function loadUser () {
    return {
        type: USER_LOAD,
        meta: {
            crossTab: true
        },
        payload: {
            promise: userService.load()
        }
    };
}

FAQs

Package last updated on 23 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc