This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get or Create a new tab id (accessible only on the tab itself) | |
var tabID = sessionStorage.tabID ? sessionStorage.tabID : sessionStorage.tabID = Math.random(); | |
// Get all connected tabs from localStorage (shared between all tabs) | |
var connectedTabs = localStorage.getItem("ConnectedTabs"); | |
// Validate if tabID was created | |
if (tabID) { | |
if (!connectedTabs) { | |
// If there's no tabs connected yet, create an array with itself tabID | |
var tabs = [tabID]; |