Created
April 27, 2017 12:22
-
-
Save ArtemAvramenko/7eaf55607cce727f4d6e4fe3ea4db55a to your computer and use it in GitHub Desktop.
Angular digest performance logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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