<?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 Jawakar Durai on Medium]]></title>
        <description><![CDATA[Stories by Jawakar Durai on Medium]]></description>
        <link>https://medium.com/@jawakarsmith?source=rss-3bc6dc5c5bfa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*iDMGGGWFcoietdYMW0Sbrg.jpeg</url>
            <title>Stories by Jawakar Durai on Medium</title>
            <link>https://medium.com/@jawakarsmith?source=rss-3bc6dc5c5bfa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 01:32:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jawakarsmith/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[Lazy loading without javascript]]></title>
            <link>https://medium.com/@jawakarsmith/lazy-loading-without-javascript-7e501648df2f?source=rss-3bc6dc5c5bfa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e501648df2f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[chrome]]></category>
            <category><![CDATA[lazy-loading]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Jawakar Durai]]></dc:creator>
            <pubDate>Tue, 14 Jul 2020 10:14:23 GMT</pubDate>
            <atom:updated>2020-07-14T10:14:23.698Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oYK8kvQYQom7C4Lg" /><figcaption>Photo by <a href="https://unsplash.com/@ejleusink?utm_source=medium&amp;utm_medium=referral">Erik-Jan Leusink</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>As per <a href="https://httparchive.org/reports/page-weight">HTTPArchive</a> images are the most requested asset type for most websites. Sites request about 2MB of images on the first load which could take more than 30 seconds in average network speed.</blockquote><blockquote>Don’t worry we can fix this 🎺</blockquote><blockquote>45% of the people visiting your site may abandon if it doesn’t complete loading under 3 seconds, and the risk goes high as 85% for mobile users.</blockquote><p>We are going to see:</p><ul><li>What is lazy loading?</li><li>how we are using lazy-loading so far?</li><li>how we can do lazy loading now and in future 🚀</li></ul><p>You are welcome to scroll down to the part Lazy loading using HTML attribute <strong>loading</strong> without JS if you want to go straight to the main content.</p><p>Let’s start.</p><h3>What is lazy loading?</h3><p>Lazy loading is a technique which allows you to load “Off-screen” images or iFrames at the moment of need, usually when the image enters the viewport. This reduces the wait time for the webpage to be interactive.</p><p>Above the fold, the area is the part of the webpage that is visible without scrolling, loading the contents above the fold faster can encourage the user to scroll. Don’t use lazy loading for above the fold content as it may slow.</p><h3>How lazy loading is being implemented?</h3><p>Lazy loading can be implemented by using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API"><strong>Intersection Observer API</strong></a><strong> </strong>which browsers provide and have good <a href="https://caniuse.com/#feat=intersectionobserver">browser support</a>.</p><h4>How does Intersection Observer work?</h4><p>The Intersection Observer API allows you to configure a callback that is called whenever one element, called the <strong>target</strong>, intersects either the device viewport or a specified element; for API, this is called the <strong>root element</strong> or <strong>root.</strong></p><p>Intersection Observer Api’s <strong>rootMargin </strong>property allows you to add a margin to the root element when you create a new IntersectionObserver instance, so that the observer will trigger the lazy loading behavior before it hit the viewport, it’ll look the same as CSS margin property</p><p>Intersection Observer also allows specifying a specific distance before the</p><h3>Example</h3><p>Let’s talk with an example of loading 30 random pictures with Intersection Observer.</p><p>index.html</p><p>Here we have src which will be the placeholder image until the element hit the viewport. Let’s add javascript</p><p>What the script does is, when the image is 500px below the viewport, it’ll set src value from data-src.</p><p>It is possible to add fallback support for IE and other unsupported browsers. Be careful about this approach as it comes with too many recurring function calls. This can inadvertently affect the performance of the webpage.</p><h4>Lazysizes</h4><p>Lazysizes is a full-fledged library for lazy loading. The pattern it uses is quite similar to the code examples shown here. It automatically binds to a lazyload class on &lt;img&gt; elements, and requires you to specify image URLs in data-src and/or data-srcset attributes, the contents of which are swapped into src and/or srcset attributes.</p><h3>Finally, Native lazy loading using HTML attributes without JS.</h3><p>Previous year Google announced that they are going to support browser level native lazy loading without in chrome and they first released a version of that in chrome canary after that released in consumer chrome, for both you have to enable a required flag chrome://flags/#enable-lazy-image-loading.</p><p>Currently, this is only supported by Chrome (v76 and above), so it’s always recommended to add a fallback for other browsers.</p><h4>💻 How it will work? Let’s try!</h4><p>native-lazy-load.html</p><p>No Javascript needed. It’ll lazy load your contents.</p><p>Here, when the content will be loaded is decided by the browser-based on</p><ul><li>The content we are lazy loading</li><li>Lite mode in android</li><li>the network connection type.</li></ul><p>You can also watch a <a href="https://web.dev/native-lazy-loading/lazyload.mp4"><em>demo</em></a><em> of this.</em></p><p>Here loading attribute supports three values lazy, auto and eager .</p><ul><li>lazy: It is the lazy loading behavior we see here.</li><li>eager: It will load all the content regardless of the content being used or not.</li><li>auto: It will use the content loading behavior of the browser, it is the same as not defining the attribute.</li></ul><h3>Future of lazy loading</h3><p>Next lazy loading we can expect is in-browser lazy loading without even specifying the loading attribute.</p><p>Thank you 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e501648df2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use “cd?]]></title>
            <link>https://medium.com/@jawakarsmith/how-to-use-cd-68ca814a50c9?source=rss-3bc6dc5c5bfa------2</link>
            <guid isPermaLink="false">https://medium.com/p/68ca814a50c9</guid>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[change-directory]]></category>
            <category><![CDATA[unix]]></category>
            <category><![CDATA[macos]]></category>
            <dc:creator><![CDATA[Jawakar Durai]]></dc:creator>
            <pubDate>Thu, 13 Feb 2020 12:23:08 GMT</pubDate>
            <atom:updated>2020-02-14T06:23:42.512Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to CD?</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27700a32d674e08a7228bcbb231f8b21/href">https://medium.com/media/27700a32d674e08a7228bcbb231f8b21/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c58ab97cb160af4d654232af80ea867/href">https://medium.com/media/8c58ab97cb160af4d654232af80ea867/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68ca814a50c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL-Intro]]></title>
            <link>https://medium.com/@jawakarsmith/graphql-intro-6c1ecb1babca?source=rss-3bc6dc5c5bfa------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c1ecb1babca</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[fullstack-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Jawakar Durai]]></dc:creator>
            <pubDate>Thu, 13 Feb 2020 11:16:48 GMT</pubDate>
            <atom:updated>2020-02-13T11:55:12.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vNATxL0I0J0qKshvXgGp5A.png" /></figure><blockquote>I’m planning to write GraphQL full stack series, this is the first of many to come, enjoy learning 😄, If you’ve written some javascript, you’re good to go for the series.</blockquote><p><a href="https://graphql.org/">GraphQL</a> is a language-independent specification for client-server communication. It lets you model the resources and processes provided by a server as a domain-specific language (DSL). Clients can use it to send scripts written in your DSL to the server to process and respond to as a batch.</p><p>GraphQL</p><ul><li>lets you write fully typed schema and you should</li><li>gives clients the power to ask for exactly what they need and nothing more</li><li>will expose only one endpoint to interact with the server</li><li>services can be written in <a href="https://graphql.org/code/">many languages</a></li></ul><h4>Example schema in NodeJs</h4><pre>const Schema = gql`<br>  type Project {<br>    name: String!<br>    createdAt: String!<br>  }</pre><pre>type User {<br>    id: ID!    <br>    name: String!<br>    email: String!<br>    Projects: [Project]<br>  }<br>`</pre><blockquote><em>It’s really </em><strong><em>okay</em></strong><em> if you don’t understand the code, you will get there in time👽</em></blockquote><h3>Mental model</h3><p>GraphQL is mostly known as a query language for clients. While this is sort of true, it’s neither a query language nor particularly graph-oriented.</p><p>It’s is not a query language cuz, there are no concepts of expressions here. You build whatever facilities to specifying and fulfilling a query on your own. Likewise, if your data is in a graph structure, if upon you to expose that. You will understand yourself in the coming articles.</p><p>To construct a page from scratch we would need to fetch data from several endpoints.</p><p>Assuming it is some project management app and you have to show projects that belong to a user, minimal things you have to fetch would be</p><ul><li><em>user info (/user/:id)</em></li><li><em>projects of the user (user/:id/projects)</em></li></ul><p>in the real world, it would be so many.</p><p>How GraphQL play in the above scenario?</p><pre># Requesting for user info and projects of a user with id 12<br>query {<br>  getUser(id: 12) {<br>    name<br>    email<br>    projects {<br>      name<br>      createdAt<br>    }<br>  }<br>}</pre><blockquote>The result will closely match the query in GraphQL.<br>So, the query will give you:</blockquote><p>will give you:</p><pre>{<br>  data: {<br>    getUser {<br>      name: “Bryan”,<br>      email: “<a href="/service/mailto:byn@fb.com">byn@fb.com</a>”,<br>      projects: [<br>        {<br>          name: “React router”,<br>          createdAt: “20–10–2010”<br>        },<br>        {<br>          name: “Create react app”,<br>         createdAt: “04–08–2016”<br>        },<br>      ],<br>    }<br>  }  <br>}</pre><p>Stare through this gif and above code to understand what I said: “<em>the result will closely match the query in GraphQL.”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*RB2I_XF4sJxKoO8sGe0Gcw.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c1ecb1babca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>