Skip to content

Instantly share code, notes, and snippets.

@zackdouglas
Created April 13, 2015 00:18
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 zackdouglas/6b2cd45906c5519dd31a to your computer and use it in GitHub Desktop.
Save zackdouglas/6b2cd45906c5519dd31a to your computer and use it in GitHub Desktop.
Attach and detach a window-wide event listener
javascript:void(function(){var f=function(e){console.log('%o:%o',this,e)},ael='addEventListener',n='click';window[ael](n,f);document[ael](n,f);window._zdf=f;}(window))
javascript:void(function(){var f=window._zdf,mel='removeEventListener',n='click';window[mel](n,f);document[mel](n,f);}(window))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment