Skip to content

Instantly share code, notes, and snippets.

@paul-bjorkstrand
Created December 18, 2014 21:30
Show Gist options
  • Save paul-bjorkstrand/8c3695699d65e0743de7 to your computer and use it in GitHub Desktop.
Save paul-bjorkstrand/8c3695699d65e0743de7 to your computer and use it in GitHub Desktop.
window.addEventListener('storage', function(e) {
if (e.storageArea === localStorage) {
var key = e.key;
if (data) {
$(document).trigger('storage.' + e.key, data);
}
}
});
$(document).on("storage.test", function(e, data) {
console.log("event fired with data", data);
});
// run this in another browser window/tab
localStorage.setItem("test", "it worked");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment