Skip to content

Instantly share code, notes, and snippets.

@nulltask
Last active April 24, 2018 16:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nulltask/7412711 to your computer and use it in GitHub Desktop.
Save nulltask/7412711 to your computer and use it in GitHub Desktop.
javascript global leak detector
var leak = (function() {
var leak = [];
var iframe = document.createElement('iframe');
iframe.style = 'display: none;';
document.body.appendChild(iframe);
var window = iframe.contentWindow;
for (var p in this) {
if (void 0 === window[p]) leak.push(p);
}
document.body.removeChild(iframe);
iframe.remove();
return leak;
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment