<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>javascript on Abdellah Codes</title>
    <link>https://abdellahcodes.xyz/tags/javascript/</link>
    <description>Recent content in javascript on Abdellah Codes</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 23 May 2023 11:29:05 +0000</lastBuildDate>
    <atom:link href="https://abdellahcodes.xyz/tags/javascript/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Understand Svelte and Sveltkit $dollar signs</title>
      <link>https://abdellahcodes.xyz/posts/understand-svelte-and-sveltkit-dollar-signs/</link>
      <pubDate>Tue, 23 May 2023 11:29:05 +0000</pubDate>
      <guid>https://abdellahcodes.xyz/posts/understand-svelte-and-sveltkit-dollar-signs/</guid>
      <description>Get a clear view whenever you encounter a $ sign in a Svelte/Sveltkit code base</description>
    </item>
    <item>
      <title>IntersectionObserver `rootMargin` option.</title>
      <link>https://abdellahcodes.xyz/posts/intersectionobserver-rootmargin-option/</link>
      <pubDate>Wed, 22 Jun 2022 00:00:00 +0000</pubDate>
      <guid>https://abdellahcodes.xyz/posts/intersectionobserver-rootmargin-option/</guid>
      <description>master the `rootMargin` option in intersection observer.</description>
    </item>
    <item>
      <title>Parallel promise execution: Beyound Promise.all()</title>
      <link>https://abdellahcodes.xyz/posts/parallel-promise-execution-beyound-promiseall/</link>
      <pubDate>Thu, 31 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://abdellahcodes.xyz/posts/parallel-promise-execution-beyound-promiseall/</guid>
      <description>In this post, I will talk about running promises in parallel and optimizing for the lowest waiting time possible.
When you have a bunch of promises that need to execute sequentially, you just run them in a sequence using .then() or awaits:
getUser() .then(user =&amp;gt; getPosts(user.id)) .then(posts =&amp;gt; use(posts)); // Or let user = await getUser(); let posts = await getPosts(user.id); use(posts); But when they don&amp;rsquo;t depend on each other like the posts that need the user id, you can run them in parallel using Promise.</description>
    </item>
    <item>
      <title>Use Typescript generics for a type safe `setTimeout` and `setInterval`</title>
      <link>https://abdellahcodes.xyz/posts/use-typescript-generics-for-a-type-safe-settimeout-and-setinterval/</link>
      <pubDate>Sun, 20 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://abdellahcodes.xyz/posts/use-typescript-generics-for-a-type-safe-settimeout-and-setinterval/</guid>
      <description>TLDR; Here&amp;rsquo;s the code:
type Handler = ((...args: any[]) =&amp;gt; any) | string; function safeSetTimeout&amp;lt;F extends Handler&amp;gt;( handler: F, timeout?: number, ...args: F extends string ? any[] : Parameters&amp;lt;F extends string ? never : F&amp;gt; ) { return setTimeout(handler, timeout, ...args); } If you understand everything in the following snippet, you don&amp;rsquo;t have much to gain from this post. But you might want check out the practical snippet at the end of this post.</description>
    </item>
    <item>
      <title>Promises | async await vs .then(), how we got here and why I use both</title>
      <link>https://abdellahcodes.xyz/posts/promises-asyncawait-vs-then-how-we-got-here-and-why-i-use-both/</link>
      <pubDate>Sat, 19 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://abdellahcodes.xyz/posts/promises-asyncawait-vs-then-how-we-got-here-and-why-i-use-both/</guid>
      <description>A bief history of js async await vs .then() and their use cases</description>
    </item>
    <item>
      <title>Promises | run any promise with a timeout</title>
      <link>https://abdellahcodes.xyz/posts/promises-run-any-promise-with-a-timeout/</link>
      <pubDate>Fri, 18 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://abdellahcodes.xyz/posts/promises-run-any-promise-with-a-timeout/</guid>
      <description>Leverage Promise.race() to give your promises a deadline to resolve or else.</description>
    </item>
  </channel>
</rss>
