Skip to content

Instantly share code, notes, and snippets.

View sahilkashyap64's full-sized avatar
🎯
Focusing

Sahil Kashyap sahilkashyap64

🎯
Focusing
View GitHub Profile
@sahilkashyap64
sahilkashyap64 / window-controller.js
Created July 10, 2021 06:10 — forked from neilj/window-controller.js
Cross-tab window controller
function WindowController () {
this.id = Math.random();
this.isMaster = false;
this.others = {};
window.addEventListener( 'storage', this, false );
window.addEventListener( 'unload', this, false );
this.broadcast( 'hello' );