Skip to content

Instantly share code, notes, and snippets.

@oscarmarina
Created June 1, 2020 06:09
Show Gist options
  • Select an option

  • Save oscarmarina/05f6476beab17417a03d9da6b77cecbd to your computer and use it in GitHub Desktop.

Select an option

Save oscarmarina/05f6476beab17417a03d9da6b77cecbd to your computer and use it in GitHub Desktop.
(function() {
if (window['StorageEvent'].name === 'StorageEvent') {
return;
}
var _setItem = window.sessionStorage.setItem;
Object.getPrototypeOf(window.sessionStorage).setItem = function(key, value) {
_setItem.call(this, key, value);
document.dispatchEvent(new CustomEvent('storage', { bubbles: true, composed: true, detail: { key: key, value: value } }));
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment