<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aaron Frost</title>
    <description>The latest articles on DEV Community by Aaron Frost (@frosty).</description>
    <link>https://dev.to/frosty</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F142143%2Fa534ad78-269f-416a-8fcc-b91ba9b1bbbf.jpg</url>
      <title>DEV Community: Aaron Frost</title>
      <link>https://dev.to/frosty</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/frosty"/>
    <language>en</language>
    <item>
      <title>You Should Upgrade to Angular 9 TODAY</title>
      <dc:creator>Aaron Frost</dc:creator>
      <pubDate>Thu, 12 Dec 2019 00:42:43 +0000</pubDate>
      <link>https://dev.to/herodevs/you-should-upgrade-to-angular-9-today-5ab3</link>
      <guid>https://dev.to/herodevs/you-should-upgrade-to-angular-9-today-5ab3</guid>
      <description>&lt;h1&gt;
  
  
  The TL;DR Version
&lt;/h1&gt;

&lt;p&gt;Let me open by briefly summarize my points of why you should upgrade today. I will cover each point in more detail lower in this article. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Angular team is actively listening to feedback from people who upgrade today. Thus, if you are worried about having problems and may need help, then now is the perfect time for you to try it and have their help. &lt;/li&gt;
&lt;li&gt;The testing cycle for this release of Angular has been one of legends. No prior version of Angular (including AngularJS) has ever gone through such a rigorous testing phase. This should help lessen your fears.&lt;/li&gt;
&lt;li&gt;The Angular community will begin to evolve more quickly once v9 is here. You will miss some of it if you are not on v9. &lt;/li&gt;
&lt;li&gt;The point of this release was to NOT provide new functionality, but to maintain the current. So you don't have to worry about massive API changes that will break you. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For those of you who have short attention spans (like me), I hope that this summary is enough to give you some talking points and/or enough to start thinking about the benefits of upgrading to Angular 9 today. &lt;/p&gt;

&lt;p&gt;And for those of you who want more reasoning, keep going. The rest of this article is for you. &lt;/p&gt;

&lt;h1&gt;
  
  
  A Longer Reasoning
&lt;/h1&gt;

&lt;p&gt;If you are going to update to Angular 9 once it is in general release 9.0.0, you should definitely do it today! Or you could wait until 9.0.1 or 9.1.0. But let me explain why I think that for this release specifically you should consider updating sooner, rather than later. &lt;/p&gt;

&lt;h3&gt;
  
  
  You Have Support From Google
&lt;/h3&gt;

&lt;p&gt;Because 9.0.0 is in RC mode, the Angular team is actively watching the feedback from people upgrading. This means that if you upgrade today, they will be listening to YOUR feedback. And when you think about it, we would rather upgrade while they are still looking at it (before they have moved their focus onto 10.0.0). If you think your team may need some help from them, then TODAY is the time for you to upgrade. &lt;/p&gt;

&lt;p&gt;In the past when I have upgraded during the RC phases, the Angular team is there listening to my issues, and asking to get on Hangouts so that they can see the issues I am dealing with. This could be you if you get on the upgrade today. &lt;/p&gt;

&lt;p&gt;At the end of the day, what helped us determine when to upgrade? We wait until we think it is "safe". Well, if you are going to have issue upgrading, wouldn't you rather have the issues while the Angular team is here to help? In the scenario where your project DOES have an issue with the upgrade, you are more "safe" doing it earlier while you still have the active attention of the team. &lt;/p&gt;

&lt;p&gt;If you try this and have an issue or any problems, you can &lt;a href="https://github.com/angular/angular/issues"&gt;file an issue on the angular repo&lt;/a&gt;, or you can try and &lt;a href="https://gitter.im/angular/angular"&gt;chat with experts on the Angular gitter&lt;/a&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  V9 Has Been Tested EXTREMELY Well
&lt;/h3&gt;

&lt;p&gt;No version of Angular has been more rigorously tested than has been Angular v9. Not even the initial release of Angular v2 went through this thorough of a testing cycle. How could it have? When v2 was released, it had a fraction of the users that Angular v8 currently has. Inherently this means that the amount of community feedback that v2 received was inconsequential when compared the the number of projects running on v8 today. &lt;/p&gt;

&lt;p&gt;So when you simply compare the number of RC and Beta users that v9 has had, it is the most tested version of Angular ever. &lt;/p&gt;

&lt;p&gt;Additionally, thanks to the version control system used internally at Google, any time the Angular team releases a change to the framework, the tests of every project at Google that depends on Angular get executed. So thousands of tests across hundreds of projects get executed for each PR from the Angular team. Clicking "Merge" on those PRs must be stressful! &lt;/p&gt;

&lt;p&gt;A few months ago, a member of the community who isn't familiar with Angular assumed that only React was heavily dog fooded prior to being released, when nothing could be further from the truth. &lt;/p&gt;

&lt;p&gt;With each PR put into Ivy and Angular 9, if any of the hundreds of projects across Google broke, the Angular team had to fix those breaks before they could move on. Knowing that the Angular team and React team have massive amounts of projects to validate their changes should help us all sleep better at night. &lt;/p&gt;

&lt;h3&gt;
  
  
  Post v9 Community Will Change Quickly
&lt;/h3&gt;

&lt;p&gt;I remember being at an Angular conference a few years ago, and joking with my friends about playing a drinking game every time someone said something about "Ivy will fix that". &lt;/p&gt;

&lt;p&gt;We have been waiting for Ivy for years now. And now that it is here, all of the changes and evolutions that were in holding patterns waiting on Ivy can now land in the community. This means that we should see some really cool things coming from some of the smartest people in the Angular community once v9 is here. &lt;/p&gt;

&lt;p&gt;And while that cambrian-explosion-esk event is happening in the Angular community, if you're sitting in Angular 6/7/8/other instead of being in 9, your project may miss out on some of the cooler new changes. &lt;/p&gt;

&lt;p&gt;Now, I am not imploring you to join the entire Angular community and chase the pendulum. In fact, I have made a solid career of NOT chasing the pendulum. However, many of the changes coming soon will be HIGHLY beneficial for any Angular project. &lt;/p&gt;

&lt;p&gt;Consider the following &lt;a href="https://twitter.com/esosanderelias/status/1075269705257095169"&gt;tweet by Sander Elias&lt;/a&gt;. If people like Sander make our life tons easier by introducing features like observable lifecycle hooks, you won't want to miss that. That's a game changer. &lt;/p&gt;

&lt;p&gt;These kinds of changes will happen often and regularly now that Ivy is here. The arrival of v9 is like undaming the water in a lake. Cool new features should begin to flow into the community. You should encourage your team to be a part of that, and even participate with changes of your own. &lt;/p&gt;

&lt;h3&gt;
  
  
  What Makes This Release Awesome Is It's LACK Of Changes
&lt;/h3&gt;

&lt;p&gt;Where almost all other releases of software are heralded and praised for what they add to the ecosystem, Angular's v9 release should be applauded for it's stability. The feature of v9 is it's LACK of features. What makes it so wonderful is it's lack of visibly wonderful changes. &lt;/p&gt;

&lt;p&gt;Angular v9 was about making major changes under the hood of the framework, without having any outward changes on our code. The API surface should remain entirely unchanged (with the exception of the few documented changes that each have schematics to make the migration pain free). The point of the release is to have every app work the same as it did before. &lt;/p&gt;

&lt;p&gt;Because this is the point of the release, it makes it a great time for your team and your projects to get on board early and be a part of the v9 upgrade party that is happening right now (before the official v9 release). &lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;One of my favorite hobbies is that of fishing. I've been doing it since I was a kid. While I still have a lot to learn, you could call me an expert in ice fishing. And when I take my friends ice fishing for the first time, many of them need me to walk out on the ice and show them that it truly is safe, and that the ice is strong and more than capable of holding us up to have a fun day. &lt;/p&gt;

&lt;p&gt;My intention in this article is not to throw guilt on those who aren't ready to update. Neither is my intention to disregard the concerns of some of those reading. We are all fighting a fight that no one else sees, and I don't pretend to understand all of what everyone is dealing with. &lt;/p&gt;

&lt;p&gt;Rather, I want to walk out on the ice and show that it is strong and much more capable that some will give it credit for. As web developers, we stand on the backs of giants to build the projects we build. The Angular team has worked hard to make a good, solid, safe release for all of us. And I believe that they have succeeded. &lt;/p&gt;

&lt;p&gt;If any of you have questions about joining me out here on in Angular v9 ice (ahead of it's official release), feel free to hit me on on Twitter. My DMs are open. &lt;/p&gt;

&lt;p&gt;If you're ready to try this out, checkout the &lt;a href="https://next.angular.io/guide/updating-to-version-9"&gt;Upgrading to Angular 9 Guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>angular</category>
      <category>rxjs</category>
      <category>typescript</category>
      <category>ngupgrade</category>
    </item>
    <item>
      <title>Route-Fully-Rendered Detection in Angular</title>
      <dc:creator>Aaron Frost</dc:creator>
      <pubDate>Mon, 04 Nov 2019 22:52:26 +0000</pubDate>
      <link>https://dev.to/herodevs/route-fully-rendered-detection-in-angular-2nh4</link>
      <guid>https://dev.to/herodevs/route-fully-rendered-detection-in-angular-2nh4</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fxaxwdp6sm0cqpydsb21u.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fxaxwdp6sm0cqpydsb21u.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;One of the main pieces of profiling an app's performance is measuring how long it takes to route from one view to another *(&lt;em&gt;more comments at end&lt;/em&gt;).  If you can track over time your app's view-to-view rendering times, then you get the powerful, God-like ability to see at-a-glance when any of your routes have slowed down unexpectedly. &lt;/p&gt;

&lt;h2&gt;
  
  
  What are you measuring?
&lt;/h2&gt;

&lt;p&gt;When you're measuring the time it takes to route from one view to another, what are you really measuring? While we could spend an afternoon discussing what the most important pieces to measure are, I am going to take another angle. Let me share the user story that I needed to solve. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As a user, I want to measure the time it takes from when I &lt;strong&gt;start to navigate&lt;/strong&gt; until the next page is &lt;strong&gt;fully rendered&lt;/strong&gt;. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So once the navigation starts, the user wants to know how long it takes until the next view is fully rendered.  Great! Now that I know what I want to measure, how do I do this in Angular? Let's talk about how I detect these two distinct moments: Navigation Start and View Fully Rendered. &lt;/p&gt;

&lt;h2&gt;
  
  
  Detecting "Navigation Start"
&lt;/h2&gt;

&lt;p&gt;All frontend frameworks that have a router make detecting the beginning of the navigation easy. Angular is no exception. In Angular, we can use the &lt;code&gt;Router&lt;/code&gt; for this. The following is a code block that we can run to grab only &lt;code&gt;NavigationStart&lt;/code&gt; events, and then track when that happens.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Injectable&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;providedIn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PerfService&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="nx"&gt;navStart$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;events&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;NavigationStart&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="nf"&gt;startWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;// Start with something, because the app doesn't fire this on appload, only on subsequent route changes&lt;/span&gt;
        &lt;span class="nf"&gt;tap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="cm"&gt;/* Place code to track NavigationStart here */&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In the above code, I am successfully detecting the start of navigation. Easy!&lt;/p&gt;

&lt;p&gt;Now let's look at what we need to do when the next view is fully rendered. &lt;/p&gt;

&lt;h2&gt;
  
  
  Detecting "View Fully Rendered"
&lt;/h2&gt;

&lt;p&gt;Angular doesn't provide a way for us to intrinsically know that a view has fully rendered. There isn't a lifecycle hook in Angular or React that says &lt;em&gt;"All Things Accounted For, I am Fully Rendered!"&lt;/em&gt;. The closest thing we have in Angular is &lt;code&gt;AfterViewInit&lt;/code&gt;, which only tells you that the initial view of the component has been rendered. Any requests to the server will blow this away. &lt;/p&gt;

&lt;p&gt;So now what?&lt;/p&gt;

&lt;h3&gt;
  
  
  A Too Simple Approach
&lt;/h3&gt;

&lt;p&gt;The simplest approach to detecting when a view is fully rendered is to look at its code, and once all of the data has been retrieved and set onto your component, you can then say that this view is fully rendered. &lt;/p&gt;

&lt;p&gt;But think about that...&lt;/p&gt;

&lt;p&gt;You have to modify every single component in your app to detect and report its &lt;code&gt;Fully Rendered&lt;/code&gt; event. That means three things: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You have to modify every top-level component in the app and teach it to report this event. &lt;/li&gt;
&lt;li&gt;You have to create an audit so that no one on your team has forgotten to report this event on any future routes. &lt;/li&gt;
&lt;li&gt;The code that reports this &lt;code&gt;Fully Rendered&lt;/code&gt; action is spread throughout your entire application. 🤢&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This was not a good enough solution. So let me tell you what I did. I wanted something that didn't require me to modify every component manually and distribute the detection code across the app. I wanted a federated approach that allowed all of the detection code to be collected into one place. So how can I do that?&lt;/p&gt;

&lt;h3&gt;
  
  
  An Accurate Approach to &lt;em&gt;Fully Rendered&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;zonejs&lt;/code&gt; to the rescue! One great things about working with Angular is that you already have &lt;code&gt;zonejs&lt;/code&gt; in your app. And for this problem, &lt;code&gt;zonejs&lt;/code&gt; is PERFECT!!&lt;/p&gt;

&lt;p&gt;When anything noteworthy happens in an Angular app, the &lt;code&gt;NgZone&lt;/code&gt; will tell you that it is not stable. And once all of the noteworthy things have finished, it will tell you that it is stable again. So, once the &lt;code&gt;NavigationStart&lt;/code&gt; fires, you can ask the &lt;code&gt;NgZone&lt;/code&gt; to tell you once all of the noteworthy things have finished happening. This way you can distinguish between your app actively rendering the next view and when the app is done retrieving data and rendering the next view. SO COOL!&lt;/p&gt;

&lt;p&gt;Anything &lt;em&gt;noteworthy&lt;/em&gt; in Angular will create whats called a &lt;strong&gt;macrotask&lt;/strong&gt; in the Angular zone. Any time we fetch new data or the component is deciding if it needs to re-render, a macrotask is created in the zone. So we can ask the zone if it has any macrotasks pending.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: I didn't use &lt;code&gt;zone.isStable&lt;/code&gt; because sometimes the &lt;code&gt;zone.isStable&lt;/code&gt; will return true, even when we have pending macrotasks. So it's better to look at the pending macrotasks.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Once the &lt;code&gt;NavitationStart&lt;/code&gt; fires, you can use some code like this:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;p&gt;&lt;span class="c1"&gt;// Once NavigationStart has fired, start checking regularly until there are&lt;/span&gt;&lt;br&gt;
&lt;span class="c1"&gt;// no more pending macrotasks in the zone&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="c1"&gt;// Have to run this outside of the zone, because the call to &lt;code&gt;interval&lt;/code&gt;&lt;/span&gt;&lt;br&gt;
&lt;span class="c1"&gt;// is itself a macrotask. Running that &lt;code&gt;interval&lt;/code&gt; inside the zone will&lt;/span&gt;&lt;br&gt;
&lt;span class="c1"&gt;// prevent the macrotasks from ever reaching zero. Running this outside&lt;/span&gt;&lt;br&gt;
&lt;span class="c1"&gt;// of Angular will not track this &lt;code&gt;interval&lt;/code&gt; as a macrotask. IMPORTANT!!&lt;/span&gt;&lt;br&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;zone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;runOutsideAngular&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br&gt;
    &lt;span class="c1"&gt;// Check very regularly to see if the pending macrotasks have all cleared&lt;/span&gt;&lt;br&gt;
    &lt;span class="nf"&gt;interval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;br&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;br&gt;
            &lt;span class="nf"&gt;startWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;// So that we don't initially wait&lt;/span&gt;&lt;br&gt;
            &lt;span class="c1"&gt;// To prevent a memory leak on two closely times route changes, take until the next nav start&lt;/span&gt;&lt;br&gt;
            &lt;span class="nf"&gt;takeUntil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;navigationStart$&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;br&gt;
            &lt;span class="c1"&gt;// Turn the interval number into the current state of the zone&lt;/span&gt;&lt;br&gt;
            &lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;zone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hasPendingMacrotasks&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;br&gt;
            &lt;span class="c1"&gt;// Don't emit until the zone state actually flips from &lt;code&gt;false&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt;&lt;/span&gt;&lt;br&gt;
            &lt;span class="nf"&gt;distinctUntilChanged&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&lt;br&gt;
            &lt;span class="c1"&gt;// Filter out unstable event. Only emit once the state is stable again&lt;/span&gt;&lt;br&gt;
            &lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stateStable&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;stateStable&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;br&gt;
            &lt;span class="c1"&gt;// Complete the observable after it emits the first result&lt;/span&gt;&lt;br&gt;
            &lt;span class="nf"&gt;take&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;br&gt;
            &lt;span class="nf"&gt;tap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stateStable&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br&gt;
                &lt;span class="c1"&gt;// FULLY RENDERED!!!!&lt;/span&gt;&lt;br&gt;
                &lt;span class="c1"&gt;// Add code here to report Fully Rendered&lt;/span&gt;&lt;br&gt;
            &lt;span class="p"&gt;})&lt;/span&gt;&lt;br&gt;
        &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;br&gt;
&lt;span class="p"&gt;});&lt;/span&gt;&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;em&gt;Voalá&lt;/em&gt;&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;At this point, we have detected both the &lt;code&gt;NavigationStart&lt;/code&gt; as well as the &lt;code&gt;Fully Rendered&lt;/code&gt; moments. We can now use something like &lt;code&gt;PerfumeJS&lt;/code&gt; to begin measuring these times. Once &lt;code&gt;PerfumeJS&lt;/code&gt; measures the times, we need to stick those into our analytics database so that we can begin to track these over time. &lt;/p&gt;

&lt;p&gt;Viewing this data over time on a per-route basis allows you to understand you apps in very meaningful ways. If an API ever slows down, the views affected will load slower, and this test will tell you. If someone checked in some bad code that is killing the app performance, this will tell you. &lt;/p&gt;

&lt;p&gt;I invite everyone to begin checking out their apps performance and using approaches like this to do that. &lt;/p&gt;

&lt;h4&gt;
  
  
  Afterthought
&lt;/h4&gt;

&lt;p&gt;In your app, if you have any long running &lt;code&gt;setInterval&lt;/code&gt; calls then it is possible that the &lt;code&gt;macrotasks&lt;/code&gt; never settle in your app. If this method doesn't work for you, then you have other issues in your app. It is very easy to find a third-party component or library that will have a &lt;code&gt;setInterval&lt;/code&gt; that will prevent your app's zone from ever settle back to zero pending macrotasks. How to find and fix these issues is the topic of another blogpost, another day. If anyone is in this situation and would like to chat about getting it fixed, please DM me on twitter :)&lt;/p&gt;

&lt;h4&gt;
  
  
  Extra Thoughts
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;*&lt;/strong&gt; Regarding the most important things to measure on your apps performance... there are a lot of things to measure. Things like &lt;em&gt;time to first byte&lt;/em&gt; or &lt;em&gt;time to first meaningful content&lt;/em&gt;. This post is not to declare that this is the most important piece of frontend performance measuring. It is, however, something that should matter when you look at how your app is performing. &lt;/p&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>performance</category>
      <category>rxjs</category>
    </item>
  </channel>
</rss>
