Skip to content

Instantly share code, notes, and snippets.

@ArtemAvramenko
Created April 27, 2017 12:22
Show Gist options
  • Save ArtemAvramenko/7eaf55607cce727f4d6e4fe3ea4db55a to your computer and use it in GitHub Desktop.
Save ArtemAvramenko/7eaf55607cce727f4d6e4fe3ea4db55a to your computer and use it in GitHub Desktop.
Angular digest performance logging
let oldDigest = GlobalServices.rootScope.$digest;
GlobalServices.rootScope.$digest = function () {
let stack = (<any>Error()).stack;
let t = new Date().getTime();
oldDigest.call(this);
t = new Date().getTime() - t;
if (t > 250) {
console.log(`$digest: ${t} ms`)
console.log(stack);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment