<?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: David Jensen</title>
    <description>The latest articles on DEV Community by David Jensen (@djjensen).</description>
    <link>https://dev.to/djjensen</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%2F420848%2F9492d4a0-915a-41c1-bf24-71727711d37b.png</url>
      <title>DEV Community: David Jensen</title>
      <link>https://dev.to/djjensen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/djjensen"/>
    <language>en</language>
    <item>
      <title>RxJS code on a deeper level.</title>
      <dc:creator>David Jensen</dc:creator>
      <pubDate>Mon, 06 Jul 2020 15:41:33 +0000</pubDate>
      <link>https://dev.to/djjensen/rxjs-code-on-a-deeper-level-4hed</link>
      <guid>https://dev.to/djjensen/rxjs-code-on-a-deeper-level-4hed</guid>
      <description>&lt;p&gt;In my effort to learn how RxJS works on a deeper level I've started reading its &lt;a href="https://github.com/ReactiveX/rxjs"&gt;github repo&lt;/a&gt;.  I've loaded it up in VS Code and made a bunch of bookmarks all over the place, at the places that I think are important.&lt;/p&gt;

&lt;p&gt;I've read so many monad tutorials from all types of sources.  I thought it would give me more insight when attempting to understand the code better. It's fascinating to see how RxJS has taken the basic (if you can call Monads basic) idea and implemented it in Javascript. I've found that it's really helped me understand the trickier pieces of its code.&lt;/p&gt;

&lt;p&gt;How does that function composition work so that it pipes the data through all of the operators?  Looking at the code you can see how each Observable is 'new'ed up and connected to each other through their source member.  Then, when the last in the line is subscribed to, it triggers a chain of calls to the operator's 'call' method, which calls the source's subscribe, which calls &lt;em&gt;that&lt;/em&gt; source's operator's 'call' method, and so forth down the line.  It's a bunch of calls.  With those connections being made, the Observer's events can propagate through the composition. The 'next', 'error', and 'complete' events are triggered in the Observer provided when creating the Observable.  &lt;a href=""&gt;Check out this post on custom Observables&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I would like to make another post on this subject.  Something of a deep, deep, deep dive into the code.  There is so much to be explored in this code.  I really like this library and it's just so powerful.&lt;/p&gt;

&lt;p&gt;I've even begun to make changes to the RxJS code to optimize it.  I took a 30 line chunk and reduced it to 5 lines. Should I make a pull request for it?  Perhaps that's too ambitious for now but I've always wanted to contribute to an open-source project. There are other places that I think the code can be improved.  For instance, each of the operators that are in the repo has a bunch of boilerplate.  They all have a generator function that does a lift that includes a 'new'ed up operator, which creates a custom observable, which creates a custom subscriber.  They are all mostly the same.  Perhaps that can be done in a shortcut. Who knows. Stay tuned.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
