<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Brock Reece on Medium]]></title>
        <description><![CDATA[Stories by Brock Reece on Medium]]></description>
        <link>https://medium.com/@brockreece?source=rss-454f71997c82------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*thVYL0FfEOdrgxzmGQMB0g.jpeg</url>
            <title>Stories by Brock Reece on Medium</title>
            <link>https://medium.com/@brockreece?source=rss-454f71997c82------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:33:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brockreece/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Unlock performance tracing in Vue]]></title>
            <link>https://medium.com/@brockreece/unlock-performance-tracing-in-vue-3b2c8f619cdc?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b2c8f619cdc</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[devtools]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[chrome-dev-tools]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Sun, 11 Feb 2018 10:23:36 GMT</pubDate>
            <atom:updated>2018-02-11T10:33:45.205Z</atom:updated>
            <content:encoded><![CDATA[<p>Being able to track the performance of your components is really useful to help debug problems with your project and it is so easy to do in Vue that you will be up and running in only a couple of minutes.</p><h4>Step 1…</h4><p>Add the following snippet to your main.js</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37a55dc5cdbefcc799479eb2eb46ea98/href">https://medium.com/media/37a55dc5cdbefcc799479eb2eb46ea98/href</a></iframe><h4>…and that’s all you have to do!</h4><p>This will turn on the Vue performance tracing, which uses the <a href="https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API/Using_the_User_Timing_API">User Timing</a> API to track your component’s <em>init</em>, <em>compile</em>, <em>render</em> and <em>patch</em> performance whilst you are in development mode.</p><h3>View in dev tools</h3><p>Google Chrome has built in support for the <strong>User Timing </strong>API and will automatically add this tracing to the visualisations in the <strong>Performance</strong> tab of your dev tools.</p><p>If you are new to analysing performance with Chrome’s dev tools, <a href="https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/">this useful guide</a> should get you up and running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q_Np5WN5HB-ETmClKf0vYg.png" /><figcaption>Vue Performance tracing in Chrome dev tools</figcaption></figure><h4>Understanding the results</h4><p>The example above shows the load performance of my application. My <strong>App.vue</strong> has two child components, <strong>Expensive</strong> and <strong>Cheap</strong>. <strong>Expensive</strong> has a taxing <em>Created</em> method and therefore takes much longer to initialise than <strong>Cheap</strong>. The visualisation indicates this by showing a longer bar for <strong>Expensive’s </strong><em>init </em>measurement<em>.</em></p><p>Because <strong>App.vue</strong> will <a href="https://medium.com/@brockreece/vue-parent-and-child-lifecycle-hooks-5d6236bd561f">wait for it’s children to mount before it mounts itself,</a> you can see that <strong>App’s</strong> <em>patch</em> measurement includes the time that both of it’s children took to <em>initialise,</em> <em>render</em> and <em>patch</em>.</p><h4>Demo</h4><p>I have created a <a href="https://91ojv2xrzw.codesandbox.io/">demo sandbox</a> with Vue performance tracing enabled so you can get started with tracing the load performance and other common interactions on a live application.</p><h3>Custom collection</h3><p>As Vue’s performance tracing uses the common User Timing API, you can also use a <a href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver">PerformaceObserver</a> to fire a callback whenever a performance entry is created by your components.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/170d2c8e05c4d056d2d8571315979a0c/href">https://medium.com/media/170d2c8e05c4d056d2d8571315979a0c/href</a></iframe><p>This could be useful for collecting data when A/B testing components for example.</p><h3>Summary</h3><p>I am fairly new to Vue’s performance tracking and used to find debugging performance bottlenecks to be a very long and manual process. Without the kind of insight that this tracing gives us, I found that it was easy to miss-attribute a component’s issue to it’s parent or siblings, but now it is quick and easy to reliably pin point problems.</p><p>Even though this is such a powerful tool, I found that it is relatively understated and couldn’t find much documentation around it, so hopefully you have found this quick introduction useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b2c8f619cdc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vue Parent and Child lifecycle hooks]]></title>
            <link>https://medium.com/@brockreece/vue-parent-and-child-lifecycle-hooks-5d6236bd561f?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d6236bd561f</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[props]]></category>
            <category><![CDATA[lifecycle]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Sat, 03 Feb 2018 18:51:07 GMT</pubDate>
            <atom:updated>2018-02-03T18:51:07.657Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have built anything in Vue, I am sure you will be familiar with the component lifecycle hooks, but you may not be aware of the unintuitive order that these hooks will fire when dealing with parent and child components and what affect that may have on your props.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*byyX8EW6mIhRsCBWwByNYg.png" /><figcaption>Vue lifecycle flowchart</figcaption></figure><h3>Parent/Child lifecycle hooks</h3><p>The example below outputs a message when the <strong>Mounted</strong> and <strong>Created</strong> hooks are fired in a parent and child setup. As you can see, the <strong>Created</strong> hooks are fired in the order that you may expect, but the <strong>Mounted</strong> hooks are fired in the opposite order.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fj38wnqjy65&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fj38wnqjy65&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fj38wnqjy65%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a0fd5ffef94349f70266d2a9d77f9ca/href">https://medium.com/media/8a0fd5ffef94349f70266d2a9d77f9ca/href</a></iframe><p>This may be hard to grasp at first, but if we follow the component initialisation workflow through logically we can understand this ordering. We just need to remember that the parent component will wait for its children to mount before it mounts its own template to the DOM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*RX2SmRXgdIsUOApbUq9HIQ.png" /><figcaption>Parent/child initialisation workflow</figcaption></figure><p>The ordering of these hooks becomes very important if your components are communicating through props.</p><h3>Reactivity in Props</h3><p>A component becomes <a href="https://vuejs.org/v2/guide/reactivity.html">reactive</a> just before the <strong>Created</strong> hook is fired, this means it will start to track changes of it’s props before it’s parent’s <strong>Mounted</strong> hook has fired. This is worth remembering if you have logic setting the value of a prop in the parent’s <strong>Mounted</strong> hooks.</p><p>The example below shows the difference between preparing your prop data in both the <strong>Created</strong> and <strong>Mounted </strong>hooks of the parent component. As you can see, the prop that was set in the <strong>Mounted</strong> hook reacts twice on the child component.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fz2yonj9kq4&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fz2yonj9kq4&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fz2yonj9kq4%2Fscreenshot.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd69ebc895f1c44b43b0103e52c315c9/href">https://medium.com/media/dd69ebc895f1c44b43b0103e52c315c9/href</a></iframe><p>Imagine if your child component made an Ajax request every time this prop changes, this would cause twice as much network activity and this could easily respond out of order.</p><h3>Summary</h3><p>If you want a deeper dive into Vue lifecycle hooks, I highly recommend the following article…</p><p><a href="https://alligator.io/vuejs/component-lifecycle/">Understanding Vue.js Lifecycle Hooks</a></p><p>But as a quick rule of thumb, I suggest only using the <strong>Mounted</strong> hook if your component needs to interact with the DOM, anything else should probably be taken care of in the <strong>Created</strong> hook.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d6236bd561f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are Nginx logs enough?]]></title>
            <link>https://medium.com/@brockreece/are-nginx-logs-enough-844b44859590?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/844b44859590</guid>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[perception]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[network]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Wed, 10 Jan 2018 21:37:37 GMT</pubDate>
            <atom:updated>2018-01-10T21:37:37.250Z</atom:updated>
            <content:encoded><![CDATA[<p>Maybe I’m just projecting but I’m sure that we have all heard reports of our site taking forever to load and I’m sure we have all dutifully checked our web server logs, aggregated some metrics, not found an issue and found comfort in a quote similar to this…</p><blockquote>Alice: How long is forever?</blockquote><blockquote>White Rabbit: Sometimes, just one second. — Lewis Carroll</blockquote><p>But the web is changing, we are moving towards SPA’s and we are running our sites on a wider range of devices. We aren’t loading everything upfront anymore and we are delegating a lot of our business logic to the browser. So gathering server-side metrics on our API fetches may not give us the whole picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*078nTZBOYt6Ei_y0L2RXsA.jpeg" /><figcaption>developer.mozilla.org</figcaption></figure><p>As you can see in the diagram above, there could be a lot more to a request than your Nginx logs can provide. So should we start collecting data from the browser to get the whole story and where can we start?</p><h3>Resource Timing</h3><p>The R<a href="https://caniuse.com/#feat=resource-timing">esource Timing API</a> is available in most modern browsers and it can be used to collect and analyse client side network performance data. The API gives you access to the <a href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming">PerformanceResourceTiming</a> objects which expose properties that can help you rebuild a rich resource loading timeline with microsecond precision. This includes…</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp">High-resolution timestamps</a> of start and end events for redirects, DNS lookups and actual requests times</li><li>The size of the response</li><li>The resource URL</li><li>The network protocol used to fetch the resource</li></ul><p>I’m not sure if Chrome and Firefox use this to build their network waterfall graphs, but as you can see from this quick example, it is easy to recreate using the Resource Timing API.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fj3zpmq98o9&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fj3zpmq98o9&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fj3zpmq98o9%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c64950776a2c7bed8b650c855b15a5f/href">https://medium.com/media/2c64950776a2c7bed8b650c855b15a5f/href</a></iframe><h4>Simple API</h4><p>The API’s power is matched by its ease of use, you can get a snapshot of all PerformanceResourceTiming objects since page load using the following snippet…</p><pre>performance.getEntriesByType(&quot;resource&quot;)</pre><h4>Listening for new activity</h4><p>Rather than periodically using the command above, you can listen for new PerformanceResourceTiming objects by using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver">PerformanceObserver</a>. The following snippet will log out a batch of network activity when the Observer is triggered.</p><pre>const performanceObserver = new window.PerformanceObserver((list) =&gt; {<br>  console.log(list.getEntries())<br>})</pre><pre>performanceObserver.observe({ entryTypes: [&#39;resource&#39;] })</pre><h4>CORS Gotcha</h4><p>If you are accessing cross domain resources, you will have to add <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Timing-Allow-Origin">Timing-Allow-Origin</a> headers to your responses to access the full range of resource stats.</p><blockquote>When <a href="https://developer.mozilla.org/en-US/docs/Glossary/CORS">CORS</a> is in effect, many of the timing properties’ values are returned as zero unless the server’s access policy permits these values to be shared. — MDN</blockquote><h3>Collecting some more context</h3><p>Most modern websites are designed to be accessed from a variety of devices that can differ wildly in spec and connection quality. If we could collect this information as well, we could use it to compare <em>like-for-like</em> connections rather than taking wide sweeping averages.</p><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator/connection">Navigator Connection API</a> gives you estimates on the user’s connection quality, such as the current bandwidth of the user’s device. The command below will return an estimate of the user’s bandwidth in Mbps, this value is based on recently observed application layer throughput across recently active connections, excluding connections made to a private address space.</p><pre>navigator.connection.bandwidth</pre><h3>Summary</h3><p>I too used to be guilty of thinking that collecting web server logs was enough to gather insights into how our website was performing, but I can now appreciate that there could be quite a difference between the end user’s perception of our sites performance and our proxied metrics.</p><p>I have recently built a websocket based service for collecting and indexing our user’s network performance metrics in our Elastic cluster, this data will then be aggregated and hopefully used to spot network performance issues and other bottlenecks. If this proves useful we may look to open source it :) but let me know if you would be interested in trying it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4QFKrzVILcz9xdZw7jG3CA.png" /><figcaption>First iteration of our network performance dashboard</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=844b44859590" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vue + WebAssembly]]></title>
            <link>https://medium.com/@brockreece/vue-webassembly-1a09e38d0389?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a09e38d0389</guid>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[webassembly]]></category>
            <category><![CDATA[wasm]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Fri, 29 Dec 2017 16:30:01 GMT</pubDate>
            <atom:updated>2017-12-29T16:30:01.531Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6pg3RdqUQMt2Xum16q3Jw.png" /></figure><p>I have recently been experimenting with using Web Assembly in my Vue project and have enjoyed programming in Rust but found that whilst the tooling around compiling the WebAssembly module is nice and easy, using it in your web application requires a bit of fiddling.</p><p>The following article hopes to outline the way I integrated my Web Assembly functions into every component in my <a href="https://github.com/vuejs-templates/webpack">Vue-cli generated Webpack project</a>.</p><h3>Webpack integration</h3><p>My main gripe with current implementation of Web Assembly is the rather <a href="https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API">cumbersome</a> way of loading your Web Assembly module into your application.</p><pre>fetch(&#39;simple.wasm&#39;).then(response =&gt;<br>  response.arrayBuffer()<br>).then(bytes =&gt;<br>  WebAssembly.instantiate(bytes, importObject)<br>).then(results =&gt; {<br>  results.instance.exports.exported_func();<br>});</pre><p>After a quick Google search, I found a great <a href="https://github.com/ballercat/wasm-loader">Webpack loader</a> that allows you to easily import your .wasm file into your project. To use this loader, you will need to add the following to your Webpack config.</p><pre>// build/webpack.base.conf.js<br>module: {<br>  rules: [<br>    ...<br>    {<br>      test: /<strong>\.</strong>wasm$/,<br>      loaders: [&#39;wasm-loader&#39;]<br>    }<br>  ]<br>}</pre><p>After you have set up your loader, you can import your .wasm<em> </em>file as you would any other JS module. The default export from the loader is a function returning a native Promise, the promise resolves to a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance">WebAssembly.Instance</a>.</p><pre>import artihmeticModule from &#39;./assets/wasm/artihmetic.wasm&#39;;</pre><pre>const arithmetic = artihmeticModule().then(({ instance }) =&gt; {<br>  return instance.exports<br>});</pre><h3>Using WA with Vue</h3><p>I believe that in a real world Application you will probably need to load multiple wasm modules, so it would make sense to create a simple reusable method to extract the functions from the WebAssembly Instance.</p><pre>import artihmeticModule from &#39;./assets/wasm/artihmetic.wasm&#39;;<br>import fibinachiModule from &#39;./assets/wasm/fibinachi.wasm&#39;;</pre><pre>const extractModule = async (module) =&gt; {<br>  const { instance } = await module();<br>  return instance.exports;<br>};</pre><pre>const arithmetic = extractModule(artihmeticModule);<br>const fibinachi = extractModule(fibinachiModule);</pre><p>To make the Web Assembly functions available in all of your Vue components, you can add something like this to the Vue <a href="https://vuejs.org/v2/cookbook/adding-instance-properties.html">prototype</a>.</p><pre>Vue.prototype.$wasm = {<br>  arithmetic: extractModule(artihmeticModule), <br>  fibinachi: extractModule(fibinachiModule),<br>};</pre><p>You can now call any imported Web Assembly function in your Vue component using the following syntax…</p><pre>this.$wasm.arithmetic.add(1, 2) // 3</pre><h3>Plugin</h3><p>I have built a Vue <a href="https://github.com/BrockReece/vue-wasm">plugin</a> to wrap the above process, which makes registering WebAssembly modules as easy as…</p><pre>// main.js<br>import Vue from &#39;vue&#39;<br>import VueWasm from &#39;vue-wasm&#39;;<br>import arithmeticModule from &#39;./assets/wasm/arithmetic.wasm&#39;;<br><br>VueWasm(Vue, { modules: { arithmetic: arithmeticModule } });</pre><p>After registering the plugin you will again be able to access the WebAssembly functions from any component using the same syntax as before.</p><pre>this.$wasm.arithmetic.add(1, 2) // 3</pre><h3>Summary</h3><p>I see the immense potential of Web Assembly and I can also see a (not so distant) future where Web developers wouldn’t necessarily build their own Rust based modules, but would consume third party Web Assembly utility libraries similar to how we use JS based libraries today, like <a href="https://lodash.com/">Lodash</a>.</p><p>To facilitate this, we will need to make it as easy as possible for developers to integrate it into their current workflow and technologies by reducing the barrier to entry. I hope the above article and plugin will help Vue developers get started with Web assembly today.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a09e38d0389" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Promises without breaking changes]]></title>
            <link>https://medium.com/@brockreece/making-promises-without-breaking-changes-83cb0ef1854e?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/83cb0ef1854e</guid>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[ecmascript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[asyncawait]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Sun, 17 Dec 2017 21:58:22 GMT</pubDate>
            <atom:updated>2017-12-17T21:58:22.545Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HPsatYRCRCfzWHhaPPWqCQ.png" /></figure><p>In this article I will outline how you can migrate an existing method to accept and resolve a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a> without having to bump your major version number.</p><h4>Contrived example</h4><p>Consider the following example, this function expects an array as its only argument and will return an array of lowercase words.</p><pre><strong>function</strong> <strong>cleanse</strong>(arr) {<br>  <strong>return</strong> arr.map(word =&gt; word.toLowerCase()) <br>}</pre><p>Now suppose we wanted to allow our users to pass through a Promise that eventually returned an array, we would probably write something like this…</p><pre><strong>function</strong> <strong>cleanse</strong>(a) {<br>  <strong>return</strong> a.then(arr =&gt; arr.map(word =&gt; word.toLowerCase())) <br>}</pre><p>But this has now introduced a breaking change to our loyal users. We want our method to handle both Promises and Arrays.</p><h4><strong>Checking for a Promise</strong></h4><p>One of the most obvious ways would be to test whether the variable is a Promise or not, a <strong><em>very</em></strong> quick and dirty way to do this would be to check whether the variable is an object and that it has a <em>then </em>method.</p><pre>if (typeof a === &#39;object&#39; &amp;&amp; typeof a.then === &#39;function&#39;) {<br>  // a is a promise<br>}</pre><p>But this isn’t very reliable and isn’t immediately obvious what we are testing for?</p><h4>Faking a Promise</h4><p>A better option would be to pass our variable into Promise.resolve which will always convert our variable into a Promise</p><pre>Promise.resolve(a)</pre><p>You can combine this with a new <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async/await</a> function which will wait for your promise to resolve before executing the rest of the function. If the variable is an array, there will be nothing to <em>await </em>and it will execute the rest straight away.</p><pre><strong>async</strong> <strong>function</strong> <strong>cleanse</strong>(a) {<br>  <strong>const</strong> resolved = <strong>await</strong> Promise.resolve(a)<br>  <strong>return</strong> resolved.map(word =&gt; word.toLowerCase())<br>}</pre><h3>Summary</h3><p>Promises are becoming more and more popular and I like to design my libraries to be as easy to consume as possible. I also don’t think we should be scared to move with the times, as long as we handle the migration responsibly and don’t leave developers behind.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83cb0ef1854e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Frontend caching strategies]]></title>
            <link>https://medium.com/@brockreece/frontend-caching-strategies-38c57f59e254?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/38c57f59e254</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[localstorage]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Sat, 25 Nov 2017 18:03:31 GMT</pubDate>
            <atom:updated>2017-11-25T18:06:07.623Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uuc8JEhBfbt2bMuAhIe2qA.jpeg" /><figcaption>If you are worrying about cache invalidation, you are in good company.</figcaption></figure><p>Frontend caching is a largely underused technique, yet it can be a very powerful optimisation if used correctly. A good reason for caching data in the browser is because we can safely assume that a network request is more expensive and unpredictable than retrieving data from a local cache.</p><p>The following article will give a very high level view on a few frontend caching concepts. I will be using <a href="https://github.com/axios/axios"><strong>Axios</strong></a> in my examples, though the techniques shown should be transferable to whichever library you use.</p><h3>Strategy 0: No caching</h3><p>If you haven’t experimented with browser based storage before, this workflow will look familiar to you.</p><pre>let data</pre><pre>axios.get(&#39;/data&#39;).then((response) =&gt; {<br>  data = response.data.data<br>})</pre><p>This approach is usually the default and means you will never have to worry about the freshness of your data in your cache… because there is no cache, but you may want to consider network latency and the knock on affect to your user’s experience.</p><h3>Strategy 1: Prefer API</h3><p>We could start by making the network request more reliable by caching the last successful response data and falling back to that if the network resource is unavailable.</p><p>This approach is very common in <strong>offline first</strong> applications, but offers little in the way of performance gains.</p><pre>let data</pre><pre>axios.get(&#39;data&#39;).then((response) =&gt; {<br>  data = response.data.data<br>}).catch(() =&gt; {<br>  data = localStorage.getItem(&#39;data&#39;)<br>})</pre><p><em>For simplicity, we are using </em><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage"><strong><em>localstorage</em></strong></a><em> to persist our data in these examples, but depending on your applications needs, you may want to look into a more grown up library, such as </em><strong><em>L</em></strong><a href="https://localforage.github.io/localForage/"><strong><em>ocalForage</em></strong></a><em>.</em></p><h3>Strategy 2: Prefer local</h3><p>In this example, we will pull the data over the network, save it to our cache and then retrieve it locally on subsequent page loads.</p><p>This strategy would offer us large performance gains but will only be useful for data that is highly unlikely to change, think populating a country or language dropdown.</p><pre>let data = localStorage.getItem(&#39;data&#39;)</pre><pre>if (!data) {<br>  axios.get(&#39;/data&#39;).then((response) =&gt; {<br>    data = response.data.data<br>    localStorage.setItem(&#39;data&#39;, response.data.data)<br>  })<br>}</pre><h3>Strategy 3: Local then API</h3><p>This strategy could be considered the best of both worlds, it will give you the performance gains of cached data retrieval and the reliability of eventually consistent data.</p><p>A brute force technique would be to preload your application with local data and then update both the application and the cache once the network request has completed.</p><pre>let data = localStorage.getItem(&#39;data&#39;)</pre><pre>axios.get(&#39;/data&#39;).then((response) =&gt; {<br>  data = response.data.data<br>  localStorage.setItem(&#39;data&#39;, response.data.data)<br>})</pre><p>We can approach this a bit more intelligently though by only making the expensive network request if something invalidates our cache, this could be time based or could even be based on a version number.</p><pre>const currentVersion = 2<br>let data = localStorage.getItem(&#39;data&#39;)<br>let version = localStorage.getItem(&#39;version&#39;)</pre><pre>if (!version || version &lt; currentVersion) {<br>  axios.get(&#39;/data&#39;).then((response) =&gt; {<br>    data = response.data.data<br>    localStorage.setItem(&#39;data&#39;, response.data.data)<br>    localStorage.setItem(&#39;version&#39;, currentVersion)<br>  })<br>}</pre><h3>Summary</h3><p>A well designed cache can not only improve your UX but also help relieve the pressure on your backend infrastructure and you will probably find that you use a combination of all of the above strategies depending on your application’s exact data needs.</p><p>If this article has piqued your interest, you might also want to consider looking into more fine grained network control with <a href="https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker">Service Workers</a> and maybe even updating your cache using push based technologies, such as web-sockets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38c57f59e254" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Monolith to Monorepo]]></title>
            <link>https://medium.com/@brockreece/from-monolith-to-monorepo-19d78ffe9175?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/19d78ffe9175</guid>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[lerna]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Tue, 07 Nov 2017 20:51:34 GMT</pubDate>
            <atom:updated>2017-11-07T20:51:34.152Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*PjXnAdk_wycWZf9QsLBDiQ.png" /></figure><p>Since starting at <a href="https://croud.com/">Croud</a>, one of our biggest projects has been the transition away from a large PHP based Monolith to a smaller service based architecture. The largest part of this was to move our frontend away from PHP generated html to static, API driven JS assets. We built a new central Restful API server and started to replace our frontend with Vue SPA’s.</p><h3>Upgrading our Monolith</h3><p>As the company required that there was as little disruption as possible, we favoured small incremental changes and decided to only replace our view layer with our SPA’s and carry on hosting our assets from our legacy Monolith.</p><p>Our legacy server slowly became a collection of Vue 1 SPA’s built by a single <strong>gulp</strong> task. This meant our production and dev builds were resource intensive and very slow. Also, as our SPA’s shared a bunch of common NPM dependencies, plugins and utility libs, it made package updates risky.</p><p>We learnt some lessons from this first stage, so I built a mental checklist of the attributes of a perfect frontend repo.</p><ul><li><strong>Greenfield projects: </strong>Decoupled, new projects are quicker and easier for new developers to work on</li><li><strong>Easy to manage: </strong>The less time we spend managing the repo, the better</li><li><strong>Share dependencies: </strong>Our projects should be able to share their dependencies to promote consistency</li><li><strong>Flexible dependency: </strong>We need the ability to sandbox some dependencies for each project so they don’t unwittingly affect other projects</li><li><strong>Quick build:</strong> The shorter the feedback loop, the better</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*ELPs7K7gPlSpAPSfrXVv_g.png" /></figure><h3>Leaving our legacy</h3><p>Around the same time that Vue released 2.0, they also released a <a href="https://github.com/vuejs/vue-cli">cli tool</a> that allowed us to build a custom generator that would quickly build a Croud flavoured <strong>Webpack</strong> SPA. We experimented with keeping each SPA in it’s own repo, away from the legacy monolith.</p><p>This offered great dependency flexibility and Webpack helped tighten up dev feedback loops. But this also quickly lead to dependency management hell and meant small changes to our core shared dependencies meant hours of careful rebuilds.</p><p>We looked into tools like <a href="https://greenkeeper.io/"><strong>Greenkeeper.io</strong></a> to help keep our dependencies inline but we found these noisy and would require us moving our repos away from BitBucket, which was largely unsupported by these tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*NkPKJmLsBO-sGqpdllj73w.png" /></figure><h3><strong>Lerna Monorepo</strong></h3><p>Inspired by how packages like <a href="https://github.com/babel/babel/blob/master/doc/design/monorepo.md"><strong>Babel</strong></a> and <strong>Jest</strong> work, I started experimenting with monorepos. A monorepo is a codebase that is organised into a single multi-package repository. <a href="https://lernajs.io/"><strong>Lerna</strong></a> is a tool that we use for building and managing our monorepo. We started by organising our packages like so…</p><pre>| monorepo/<br>| ---- package.json<br>| ---- packages/<br>| -------- package-a/<br>| ------------ package.json<br>| -------- package-b/<br>| ------------ package.json<br>...</pre><p>Our project’s root package.json will handle the shared dependencies and the root directory will also house things like the <strong>babel</strong> and <strong>eslint</strong> config. While the packages directory will contain each of our SPA’s.</p><h4>Lerna tools</h4><p><a href="https://lernajs.io/">Lerna</a> has some command line tools to help you manage your monorepo, you can import existing packages, build all package assets and even publish new versions of your packages to NPM from the cli.</p><p>Each package still has it’s own individual Webpack build, so it can be developed and built in complete isolation as if they were in separate repos.</p><h4>Yarn Workspaces</h4><p>Our monorepo leverages <a href="https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/"><strong>Yarn Workspaces</strong></a> for handling multiple nested <strong>package.json </strong>files.<strong> </strong>This gives us both consistency and flexibility in managing dependencies by setting a core set of dependencies in the parent directory but allowing the project subdirectories to override these defaults and add additional dependencies as they needed to.</p><p>Lerna can also handle all of your <a href="https://yarnpkg.com/lang/en/docs/cli/link/"><strong>Yarn Links</strong></a><strong> </strong>so we can add your NPM hosted packages to the monorepo for local development.</p><h4>Docker</h4><p>We have also included a docker config file in our monorepo which strips out everything but the <strong>dist</strong> directory of our packages and mounts them in a simple Nginx container, ready to be integrated into our Rancher stacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*WfFlzvHbmlv2Qbo-LYN_5g.png" /></figure><h3><strong>Summary</strong></h3><p><strong>Lerna</strong> and <strong>Yarn Workspaces</strong> is a powerful combination and has allowed us to develop quickly and reduce the management overhead. It seems to tick all the boxes in our mental checklist and is scaling well too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19d78ffe9175" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scoped styles with v-html]]></title>
            <link>https://medium.com/@brockreece/scoped-styles-with-v-html-c0f6d2dc5d8e?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0f6d2dc5d8e</guid>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Wed, 18 Oct 2017 15:37:55 GMT</pubDate>
            <atom:updated>2017-10-18T15:37:55.129Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*TeedB1A6ysm7puVl22ISyA.png" /><figcaption>Scoped css with a deep selector</figcaption></figure><p>Scoped css is awesome and I strongly encourage its use when building reusable components. It stops the css rules of your component bleeding out into other areas of your app by assigning your component`s DOM elements with a unique attribute (such as <strong>data-v-f3f3eg9</strong>) and then appending your css rules with this attribute. Which will transpile this…</p><pre>&lt;style scoped&gt; <br>  .a .b { /* ... */ } <br>&lt;/style&gt;</pre><p>… into this …</p><pre>.a .b[data-v-f3f3eg9] { /* ... */ }</pre><h3><strong>Usage with v-html</strong></h3><p>However, when using the <strong>v-html</strong> directive, <a href="https://vue-loader.vuejs.org/">Vue-Loader</a> does not assign the component`s attribute to the elements in the v-html’s markup. This moves the v-html’s markup out of the scope of the component`s styling and means it can’t be targeted in the usual way.</p><h3>Deep Selectors</h3><p>As of V<a href="https://github.com/vuejs/vue-loader/releases/tag/v12.2.0">ue-Loader 12.0.2</a> you can use the <strong>&gt;&gt;&gt; </strong>combinator to change what part of the css rule the component’s attribute is attached to. This means you can anchor your rule on something that is in your component’s template and target its children from there.</p><pre>&lt;style scoped&gt; <br>  .a &gt;&gt;&gt; .b { /* ... */ } <br>&lt;/style&gt;</pre><p>Will output something like this…</p><pre>.a[data-v-f3f3eg9] .b { /* ... */ }</pre><h3>Full example</h3><p>For those of you just here for the code, here is a full example… I hope this saves you all some Googling…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df3b3e02e11989f81c649b05ea8c30e3/href">https://medium.com/media/df3b3e02e11989f81c649b05ea8c30e3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0f6d2dc5d8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Collaborative documents in Vue]]></title>
            <link>https://medium.com/@brockreece/collaborative-documents-in-vue-5eca0014e088?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/5eca0014e088</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[quilljs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[realtime]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Sun, 08 Oct 2017 18:50:23 GMT</pubDate>
            <atom:updated>2017-10-08T18:50:23.810Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1veQvZrI5uwH2-hP2ybghg.png" /><figcaption>Quill deltas fit perfectly with Firebase</figcaption></figure><p>In this article, we are not aiming to rival Google docs, but in about 20 minutes we should be able to create a realtime collaborative document using Vue, Firebase and Quill.js</p><p><a href="https://quilljs.com/">Quill</a>.js is a text editor that uses <a href="https://quilljs.com/docs/delta/">deltas</a> (json objects) to represent it’s markup and this fits perfectly into the way Firebase stores json data. <a href="https://firebase.google.com/">Firebase</a> is a database platform built by Google, that uses websockets to update it’s connected clients in realtime.</p><h3>Vue-quill</h3><p>I am a huge fan of <a href="https://quilljs.com/">Quill</a>, so much so that when I switched to using Vue last year, creating a community wrapper for the JSON based text editor was high on my priority list. For this project, we will be using a relatively simple setup of <a href="https://github.com/CroudSupport/vue-quill">vue-quill</a>, first we will use <strong>yarn</strong> to add the lib to our project.</p><pre>yarn add vue-quill</pre><p>And then we will add the plugin to Vue in our <strong>main.js</strong>. The plugin will globally register a quill component that we will use later on.</p><pre># main.js<br>import Vue from vue<br>import VueQuill from vue-quill</pre><pre>Vue.use(VueQuill)<br>...</pre><p><em>For more advanced configs see the vue-quill </em><a href="https://github.com/CroudSupport/vue-quill"><em>docs</em></a></p><h3>Firebase and vuefire</h3><p>I am new to Firebase and was amazed how simple the <a href="https://github.com/vuejs/vuefire">vuefire</a> plugin made it to integrate it into my Vue project. I suggest you visit their project page for more examples, as we are only skimming the surface here. Like vue-quill, we will use <strong>yarn</strong> to add <strong>firebase</strong> and <strong>vuefire</strong> to our project.</p><pre>yarn add firebase vuefire</pre><p>And then we will add the vuefire plugin to Vue in our <strong>main.js</strong></p><pre># main.js<br>...<br>import VueFire from &#39;vuefire&#39;;<br>...</pre><pre>Vue.use(VueFire)</pre><p>Before we go any further, we will need to create a new database in the <a href="https://console.firebase.google.com/">Firebase console</a>, for this example I named my database ‘quill’. If you are new to Firebase, Google’s <a href="https://firebase.google.com/docs/database/web/start">documentation</a> will walk you through how to do this.</p><h3>Building our Vue component</h3><p>Below is the starting point of our app.vue. You will need to pass in your Firebase project’s config to the <em>Firebase.initializeApp</em> method, you can find these details from within the <a href="https://console.firebase.google.com/">Firebase console</a> by clicking on the <strong>Settings</strong> <strong>cog</strong> next to the <strong>Overview</strong> section in the left hand menu and choosing the <strong>Add Firebase to your web app </strong>option.</p><pre># app.vue</pre><pre>&lt;template&gt;  <br>  &lt;quill ref=&quot;quill&quot;/&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>import Firebase from &#39;firebase&#39;;</pre><pre>const app = Firebase.initializeApp({<br>  apiKey: &#39;****&#39;,<br>  authDomain: &#39;****&#39;,<br>  databaseURL: &#39;****&#39;,<br>  projectId: &#39;****&#39;,<br>  storageBucket: &#39;****&#39;,<br>  messagingSenderId: &#39;****&#39;,<br>});<br>const db = app.database();</pre><pre>export default {</pre><pre>}</pre><pre>&lt;/script&gt;</pre><p>Vuefire helps us integrate our Firebase database by defining a <em>firebase</em> object in our Vue component. In our example below accessing <em>this.quillContent </em>from within this component<em> </em>will return the current value of our database.</p><pre>...<br>export default {<br>  firebase: {<br>    quillContent: {<br>      source: db.ref(&#39;/quill&#39;),<br>      asObject: true,<br>    },<br>  },<br>}<br>...</pre><h3>Realtime updates</h3><p>Now we have set up our component, we will need to listen for changes in our quill component and update Firebase with our new delta. For this we will add a listener to the quill component and use lodash to debounce this update to 1 second after the user stops typing or making changes.</p><pre>&lt;template&gt;  <br>  &lt;quill @input=&quot;updateFirebase&quot; ref=&quot;quill&quot;/&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>import _ from &#39;lodash&#39;</pre><pre>...<br>methods: {<br>  updateFirebase: _.debounce(function (content) {<br>    this.$firebaseRefs.quillContent.set(content);<br>  }, 1000),<br>}<br>...<br>&lt;/script&gt;</pre><p>As Firebase pushes changes to it’s connected clients when a new delta is published, we will also need to listen for these changes. In a mounted method, we will register a watcher for <strong>quillContent</strong> that will update the contents of our quill component whenever a change is pushed out from Firebase</p><pre>mounted() {<br>  this.$watch(&#39;quillContent&#39;, (val) =&gt; {<br>    if (this.$refs.quill) {<br>      this.$refs.quill.editor.setContents(val, &#39;silent&#39;);<br>    }<br>  })<br>},</pre><p>And that should do it, open up a couple of browser tabs and watch how your updates in one editor are replicated in the other tabs almost instantly.</p><h3>Summary</h3><p>This is a just a starting point, but hopefully I have introduced you to a few new technologies and techniques for you to go on and build a rich realtime collaborative web app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5eca0014e088" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Should I Use…]]></title>
            <link>https://medium.com/@brockreece/should-i-use-9d9693c99122?source=rss-454f71997c82------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d9693c99122</guid>
            <category><![CDATA[google-analytics]]></category>
            <category><![CDATA[caniuse]]></category>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[service-worker]]></category>
            <category><![CDATA[data-driven-decisions]]></category>
            <dc:creator><![CDATA[Brock Reece]]></dc:creator>
            <pubDate>Sat, 07 Oct 2017 14:44:36 GMT</pubDate>
            <atom:updated>2017-10-07T14:44:36.607Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hueppiB0wToluU39wtVwUQ.png" /><figcaption>Mixing CanIUse with GA</figcaption></figure><p>Recently I have been playing around with <a href="https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API">Service Workers</a>. I am really excited around the possibility of offline access and I think my users would benefit from investing some time in Service Workers. But I have also heard that this relatively new technology isn’t actually supported in all modern browsers and I would like to make a data driven decision.</p><h3>Can I Use</h3><p><a href="https://caniuse.com/">caniuse.com</a> is my go to for finding out which browsers support different front end technologies. You can use their large search box to find a feature and it instantly gives you a breakdown of browser support as well as giving you location aggregated support percentages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*hpIRsfVN-8WbmP2bSEkCgQ.png" /><figcaption>Only 48% of UK users’ browsers support service workers…</figcaption></figure><p>So this looks pretty fatal for Service Workers, more than half of my local users would not see any benefit. But I have a hunch that my users are a bit more tech savvy than the average user and would be using a more feature rich browser.</p><h3><strong>Mixing with Google Analytics</strong></h3><p>A little known feature of CanIUse is its integration with your Google Analytics data. Google Analytics gathers browser usage from all of your users and you can import these stats into CanIUse. To import this data click on the <strong>Settings</strong> button next to the search box and you will see the following menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*qqLuqyp4NT9jILg6OXtZUw.png" /><figcaption>Click on the ‘Import’ button underneath to show your users’ browser data in CanIUse</figcaption></figure><p>After clicking <strong>Import</strong>, a modal will pop up and walk you through importing your Google Analytics browser stats into CanIUse. Once this is complete you will see a new row in your support aggregations in the top right hand corner, this shows you the percentage of your users that support a certain technology.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*6Z0oLFu-ht6_V0o8rgwPXg.png" /><figcaption>The top row shows the percentage of my user base that supports service workers</figcaption></figure><p>So this new data confirms my hunch and I can now be more confident that my investment in Service Workers would benefit a large proportion of my user base.</p><h3>Summary</h3><p>There are a lot of exciting Browser API changes coming up in the next 18 months, a few of the best are covered in this excellent <a href="http://shoptalkshow.com/episodes/278-top-5-browser-apis-youre-not-using-patrick-kettner/">Shop Talk Show episode</a>, and I can see many discussions over which new technologies to invest in. Hopefully you can use this combination of CanIUse and Google Analytics to help you decide.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d9693c99122" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>