SFIntercom is a client-side library that allow cross-tab communication with same domain. It can broadcast to all listener on a different tab or window, but can't broadcast to other browser instance.
This library was useful for syncronizing message, notification, and other data.
// First tab
var client1 = new SFIntercom();
client1.on('log', console.log);
client1.on('warn', console.warn);
// Second tab
var client2 = new SFIntercom();
client2.on('log', console.log);
client2.emit('log', 'Hello from second tab'); // Broadcast to all except this tab
// Third tab
var broadcaster = new SFIntercom();
broadcaster.emit('log', "Hello from third tab"); // Broadcast to all
broadcaster.emit('warn', "Hello warn"); // Broadcast to all who listen to 'warn'
If you want to help in SFIntercom library, please fork this project and edit on your repository, then make a pull request to here.
Keep the code simple and clear.
SFIntercom is under the MIT license. But don't forget to put the a link to this repository.