Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class Timer {
readonly start =;
constructor(private readonly name: string) {}
stop() {
const time = - this.start;
console.log('Timer:',, 'finished in', Math.round(time), 'ms');
private t: Timer;
// When change detection begins
ngDoCheck() {
this.t = new Timer('Cardbock block render');
// When change detection has finished:
// child components created, all *ngIfs evaluated
ngAfterViewChecked() {
this.t.stop(); // Prints the time elapsed to the JS console.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.