WebPagetest Forums
W3C User Timing in Angular - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: General Discussion (/forumdisplay.php?fid=25)
+--- Thread: W3C User Timing in Angular (/showthread.php?tid=15694)

W3C User Timing in Angular - chelvan - 03-01-2019 02:12 AM

I am attempting to insert User Timing Marks into an Angular App. I want to measure when a content element on the page is displayed. For example, I'd like to find out when content ATF has rendered.

The content is within the app.component.html file so I thought that it made sense to place there. But it appears that when the page renders, the timing marks do not display when I look at the Chrome Dev tools timing area.

I am using the sample Angular setup page:

<!--The content below is only a placeholder and can be replaced.-->
<script>window.performance && performance.mark && performance.mark("ATFAreaBegin")</script>

<div style="text-align:center">
Test Page {{ title }}!

<h2>Here are some links to help you start: </h2>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
<script>window.performance && performance.mark && performance.mark("ATFAreaEnd")</script>
<script>window.performance && performance.measure && performance.measure("ATFDuration", "ATFAreaBegin", "ATFAreEnd");</script>

At a basic level, does anyone have any example of how to accomplish this in Angular? I haven't been able to find any documentation with a specific example. Any marks within the index.html page are output.

Any information would really be helpful.