Skip to content

Instantly share code, notes, and snippets.

@marcodejongh
Created September 16, 2014 08:37
Show Gist options
  • Save marcodejongh/694f156c18eba0e8ab8a to your computer and use it in GitHub Desktop.
Save marcodejongh/694f156c18eba0e8ab8a to your computer and use it in GitHub Desktop.
var oldDestroy = Blaze.DOMRange._destroy;
var counter, domTimeout, startTime, endTime;
Blaze.DOMRange._destroy = function () {
//I love monkey-patching
if(monitorBlaze) {
endTime = new Date().getTime();
if(domTimeout) {
Meteor.clearTimeout(domTimeout);
} else {
counter = 0;
console.log('Blaze voodoo magic commences');
startTime = new Date().getTime();
}
domTimeout = Meteor.setTimeout(function () {
console.log('Blaze magic finishes with: ' + counter + ' destroys' + ' done in ' + (endTime - startTime) + 'ms' );
monitorBlaze = false;
domTimeout = null;
}, 1000);
counter++;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment