Skip to content

Instantly share code, notes, and snippets.

@toddpi314
Created June 5, 2012 01:23
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 toddpi314/2871861 to your computer and use it in GitHub Desktop.
Save toddpi314/2871861 to your computer and use it in GitHub Desktop.
Closure Pinning Memory Leak - Fixed 1
// On Component.attach, lets subscribe to the
// DOM's loaded event and do something on our
// self closure context
Component.prototype.attach = function() {
var self = this;
$(document).load(function() {
// Self reference removed, not causing closure leak
//self.onLoaded();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment