Skip to content

Instantly share code, notes, and snippets.

@zackify
Created June 10, 2020 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackify/cf1335480eeae454fd45383099f1238b to your computer and use it in GitHub Desktop.
Save zackify/cf1335480eeae454fd45383099f1238b to your computer and use it in GitHub Desktop.
if (typeof window === 'undefined') {
global.window = new Proxy(
{},
{
get: (_, key) => {
// may need to add new stuff here to account for other method types
return () => global.window;
},
set: target => console.log(target),
}
);
}
window.addEventListener('test', () => true);
window.removeEventListener('test', () => true);
console.log(window.location.href);
window.location.search = 'blah';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment