Created
December 18, 2014 21:30
-
-
Save paul-bjorkstrand/8c3695699d65e0743de7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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