I want to use localsync in React to log user out of all tabs when they log out of one tab.
When the trigger is called, the action executes in one tab, but the handler is not called in another. Tested in Chrome. I have something like the following:
export class App extends Component {
componentDidMount(){
this.globalLogout = localsync('logout', this.syncAction, this.localLogout, {tracing: true});
}
syncAction = () => {/*do nothing*/ return;}
localLogout = () => {console.log("user has been logged out of this tab");}
logoutUser = () => {
this.localLogout();
this.globalLogout.trigger();
}
}
In the console, I got storagesync#start on for each Chrome tab that I opened. I then got storagesync#trigger > [] on calling logoutUser in one tab, but nothing happens in the other tabs. I expected to get the message "user has been logged out of this tab" on every tab.
I want to use localsync in React to log user out of all tabs when they log out of one tab.
When the trigger is called, the action executes in one tab, but the handler is not called in another. Tested in Chrome. I have something like the following:
In the console, I got
storagesync#starton for each Chrome tab that I opened. I then gotstoragesync#trigger > []on calling logoutUser in one tab, but nothing happens in the other tabs. I expected to get the message "user has been logged out of this tab" on every tab.