Last active
October 11, 2018 21:24
-
-
Save xthecapx/5cacdbfc41e5abdcdb3097a8c99c9dbf to your computer and use it in GitHub Desktop.
This file contains 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
import { perfume } from 'src/app/perfume'; | |
import { PerfumeAfterViewInit } from 'perfume.js/angular'; | |
@Component({ | |
selector: 'ngfor-perfomance', | |
template: ` | |
<ul> | |
<li *ngFor="let d of data; let l = last; let f = first;"> | |
<span *ngIf="f">{{ngForCallback(true)}}</span> | |
{{d.name}} | |
<span *ngIf="l">{{ngForCallback(false)}}</span> | |
</li> | |
</ul> | |
` | |
}) | |
@PerfumeAfterViewInit('TestingComponent') | |
export class TestingComponent { | |
public ngForCallback(value) { | |
if (value) { | |
perfume.getInstance().start('NgForFullLoop'); | |
} else if (!value) { | |
const duration = <number>perfume.getInstance().end('NgForFullLoop'); | |
perfume.getInstance().log("NgForFullLoop took: ", duration); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment