<?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 Trishna Kalita on Medium]]></title>
        <description><![CDATA[Stories by Trishna Kalita on Medium]]></description>
        <link>https://medium.com/@trishnakalita?source=rss-ada907a97161------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xxBRAR-5Ds12s1Cf</url>
            <title>Stories by Trishna Kalita on Medium</title>
            <link>https://medium.com/@trishnakalita?source=rss-ada907a97161------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:19:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@trishnakalita/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[THROTTLING]]></title>
            <link>https://medium.com/@trishnakalita/throttling-in-javascript-84d4eee498c?source=rss-ada907a97161------2</link>
            <guid isPermaLink="false">https://medium.com/p/84d4eee498c</guid>
            <dc:creator><![CDATA[Trishna Kalita]]></dc:creator>
            <pubDate>Fri, 15 Oct 2021 18:10:13 GMT</pubDate>
            <atom:updated>2021-10-15T18:10:39.780Z</atom:updated>
            <content:encoded><![CDATA[<p>Let me tell you the reason behind using this, since I personally like to know about the usage of a particular thing before implementing it in my code.</p><p>So, do you belong to that group of people who clicks on a button several times impatiently when you don’t get the desired action after clicking that button?<br>I guess for impatient people like me ( Yes, I used to do it in my first year), the developers implemented this!<br> Having said that, let’s go through the definition of this concept with its quick implementation.</p><p>Throttling or a throttle function is a practice used in websites which controls the rate at which a function is called, i.e. it is used to call a function after every millisecond or after a particular interval of time, after the first click is executed.</p><p>As I was giving the scenario in the above paragraph, suppose the button you were clicking impatiently was making an API call when it’s onClick event was triggered. So if you click it 10 times it will make 10 calls to the same API, which is unnecessary. A developer can limit this by throttling that button.</p><p>Advantages of throttling function? It simply prevents frequent unnecessary calling of a function, thus controlling the rate at which a particular function is called. And also it makes the website efficient!</p><p>Here’s it’s quick implementation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*qf3fN9DauMWi14MLBe6h-g.png" /></figure><p>Now I have a simple question, what will be the value of the count variable if I call the function throttle like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*TBk4mBWD6_WZxbSQxqIriw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84d4eee498c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DEBOUNCING]]></title>
            <link>https://medium.com/@trishnakalita/debouncing-bd0258b94f34?source=rss-ada907a97161------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd0258b94f34</guid>
            <dc:creator><![CDATA[Trishna Kalita]]></dc:creator>
            <pubDate>Sat, 14 Aug 2021 16:56:45 GMT</pubDate>
            <atom:updated>2021-08-14T19:01:52.243Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s start with usage first, since I, personally like to learn about the usage first and then dive deeper into the concepts.</p><p>Using E-commerce websites like Flipkart, Amazon etc. are really common now a days. So whenever, as a user you type something in the search bar, the utility behind it makes an API call which fetches the data for the user’s required search.<br>So the question comes up is that, are the API calls made for each and every letter typed on the search bar? Let’s suppose the user wants to find “school bags” for his kid, so how many API calls will be made and how is it decided that an ‘x’ number of API calls are made? <br> Yes, there comes the concept of Debouncing.</p><p>Having mentioned that let’s go through the definition with its implementation:</p><p>The intuition behind it is to make a particular function wait a certain amount of time before running again.<br>“Debouncing in JavaScript is a practice used to improve browser performance. There might be some functionality in a web page which requires time-consuming computations. If such a method is invoked frequently, it might greatly affect the performance of the browser, as JavaScript is a single threaded language. <br>Debouncing is a programming practice used to ensure that time-consuming tasks do not fire so often, that it stalls the performance of the web page. In other words, it limits the rate at which a function gets invoked.”</p><p>So answering the above question, so without debouncing, if a user types “School Bags” around 10 API calls would be made. But the developer developing the application is smart enough and configures it in such a way that if user types “School” wait for 2–3 seconds and then types “Bags” only 2/3 API calls will be made using the concept of debouncing.</p><p>Reason behind using it is simple, it improves performance of the application and might prevent your browser from freezing!</p><p>IMPLEMENTATION:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*HifNu-mIqBmoloD3UC6_cQ.png" /></figure><p>Debouncing takes two args as shown above and it makes sure that no unnecessary calls are made and only makes a call when the interval between 2 function calls is greater than the delay (passed in the function argument).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd0258b94f34" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>