{"id":2009,"date":"2019-12-10T12:07:57","date_gmt":"2019-12-10T11:07:57","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/uncategorized\/the-magic-behind-rxjs\/"},"modified":"2021-12-23T15:30:19","modified_gmt":"2021-12-23T14:30:19","slug":"the-magic-behind-rxjs","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/","title":{"rendered":"The Magic behind RxJS"},"content":{"rendered":"<p>Reinventing the wheel is often necessary in order to understand how a library works under the hood and to better learn something complex.<\/p>\n<p>It is a very good option, contrary to popular belief, in the case of a <span id=\"urn:enhancement-a54cdeeb\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_developer\">developer<\/span> wanting to improve his\/her knowledge.<\/p>\n<p>Max Gallo, at <strong>Codemotion Rome 2019<\/strong>, performed a <span id=\"urn:enhancement-c498c8c1\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/live_coding\">live coding<\/span> session, where he showed us how we can reverse engineer the <strong>RxJS library<\/strong>, <strong>the Reactive Extensions for <span id=\"urn:enhancement-55ea038d\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/javascript\">JavaScript<\/span> language<\/strong> which allows you to write <span id=\"urn:enhancement-e62ddc2d\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/reactive_programming\">reactive<\/span> <span id=\"urn:enhancement-5dec3b5b\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_program\">programs<\/span> with a functional approach.<\/p>\n<p>Max Gallo is an engineer working at DAZN, and he is experienced as a Full Stack <span id=\"urn:enhancement-81a25ba3\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_developer\">Developer<\/span>, iOS <span id=\"urn:enhancement-713f23aa\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_developer\">Developer<\/span> and <span id=\"urn:enhancement-e24fb96a\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_interface\">UI<\/span>\/UX Designer.<\/p>\n<p><strong>RxJS<\/strong> is a library with a clear <strong><span id=\"urn:enhancement-6cbd276b\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/application_programming_interface\">API<\/span><\/strong> to work with both <strong><span id=\"urn:enhancement-3218f80\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/asynchrony\">asynchronous<\/span><\/strong> and <strong>synchronous<\/strong> code, thanks to pipeline operators and using the concept of Observable.<\/p>\n<blockquote>\n<p><em>The observer pattern is a <span id=\"urn:enhancement-2b00934f\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_design\">software design<\/span> pattern in which an object, called the subject, maintains a list of its dependents, called observers, and automatically notifies them of any state changes (usually by calling one of their methods). <\/em>(<span id=\"urn:enhancement-6db61edb\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/wikipedia\">Wikipedia<\/span>)<\/p>\n<\/blockquote>\n<p>What is the goal of this topic? A lot of people are afraid of Observable and RxJS library, so Max\u2019s intention was to show us how we can build something like RxJS, of course, not all of the standard library, just some line of working demo code, and he did with a VI editor. Cool! We can now create custom operators.<\/p>\n<blockquote>\n<p><em>An operator is simple a <span id=\"urn:enhancement-d455522c\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span>, they are the horse-power behind observables, providing an elegant, declarative and common <span id=\"urn:enhancement-e16f7a1\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/application_programming_interface\">API<\/span> to complex tasks in both async\/sync world.<\/em><\/p>\n<\/blockquote>\n<figure class=\"image regular \"><picture><source srcset=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/MY-IMAGE_1_1c12aad4a022c2475d03af0169909343_800.jpg 1x, https:\/\/images.storychief.com\/account_16344\/MY-IMAGE_1_1c12aad4a022c2475d03af0169909343_1600.jpg 2x\" media=\"(max-width: 768px)\" \/><source srcset=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/MY-IMAGE_1_1c12aad4a022c2475d03af0169909343_800.jpg 1x, https:\/\/images.storychief.com\/account_16344\/MY-IMAGE_1_1c12aad4a022c2475d03af0169909343_1600.jpg 2x\" media=\"(min-width: 769px)\" \/><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/MY-IMAGE_1_1c12aad4a022c2475d03af0169909343_800.jpg\" alt=\"\" \/><\/picture>\n<figcaption>Max showing RxJS Library<\/figcaption>\n<\/figure>\n<p>If you\u2019ve used RxJS before and want to better understand some internal aspects of the library and the magic behind Observables, as well as the operators, then this post is for you.<\/p>\n<p>Firstly, Max began with showing us some RxJS code, how to create an Observable from an Array with some operators within the pipeline operator, introduced with the latest RxJS 6 release (it was actually already added in\u00a0RxJS\u00a05.5), in substitution of dot-chaining operators. Then, a step forward, he rewrote a couple of the most common <span id=\"urn:enhancement-3186eaf9\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> operators: from and map, fully compatible with RxJS. So we can now write our custom operators! Wow!<\/p>\n<h2 id=\"bvuvg\">RxJS<\/h2>\n<p>\u00a0<\/p>\n<p>Let&#8217;s explore this. The purpose of the library is to offer a wide range of operators to transform, manipulate and create a stream of data from a source such as an event from <span id=\"urn:enhancement-56fae41e\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_interface\">UI<\/span>, from a XHR response or from some sort of data (an array, a collection or whatever you want to stream and observe).<\/p>\n<p>A stream is a collection of future values and it\u2019s called Subject or Observable; it can emit three different kinds of event with a value (object, array, primitive value), an error or a completed event when the full cycle of values are finished.<\/p>\n<p>Observable is an Object with\u00a0a subscribe\u00a0<span id=\"urn:enhancement-428aca7c\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> on it. This\u00a0subscribe\u00a0<span id=\"urn:enhancement-4261443a\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> takes the\u00a0observer\u00a0as an argument and is used to invoke the execution of the Observable. In the RxJS library, the subscribe <span id=\"urn:enhancement-fa796c20\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> returns a reference to an unsubscribe, which allows us to spot listen to the values emitted by Observable.<\/p>\n<p>Observables can either be <span id=\"urn:enhancement-22422a62\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/asynchrony\">asynchronous<\/span> or synchronous, depending on the underlying implementation. An example of an <span id=\"urn:enhancement-91831d85\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/asynchrony\">asynchronous<\/span> observable is one that wraps an XHR call or a timer <span id=\"urn:enhancement-1b7e34bf\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span>, while a stream of values comes from an array can be synchronous.<\/p>\n<p>However, we capture these emitted events only asynchronously, with an Observer, by defining three parameters:<\/p>\n<ol>\n<li>a <span id=\"urn:enhancement-a14ad985\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> for the value emitted is succeeded;<\/li>\n<li>a <span id=\"urn:enhancement-227e9212\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> when an error is emitted;<\/li>\n<li>a <span id=\"urn:enhancement-5dc8bc27\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> when &#8216;completed&#8217; is emitted.<\/li>\n<\/ol>\n<p>Observer is a collection of callback functions, which reacts to the value arriving via Observable.<\/p>\n<p>You can recap the relationship from Observable, Observer, Subscribe and Subscription with a type definition in TypeScript:<\/p>\n<pre>  Observable.subscribe(observer:Observer):Subscription;<\/pre>\n<p>So far, we have read what is an Observable and how to subscribed to them. With RxJS we can <span id=\"urn:enhancement-18918aca\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_program\">program<\/span> in a functional way with <span id=\"urn:enhancement-5ca682c1\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/asynchrony\">asynchronous<\/span> values, we can use Array\u2019s map, filter or any other <span id=\"urn:enhancement-631b08b1\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">methods<\/span> and operators to modify the original Observable.<\/p>\n<p>Those operators are chainable and composable and to work with them we have a <span id=\"urn:enhancement-aae6014c\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> on the Observable object named\u00a0<strong>pipe.<\/strong>\u00a0This pipe <span id=\"urn:enhancement-bc3e18f7\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> takes single or multiple operators as an input and returns a new Observable.<\/p>\n<p>Here is an example of using a\u00a0<strong>filter\u00a0<\/strong>and<strong>\u00a0map<\/strong>\u00a0operator in RxJS:<\/p>\n<pre>const { from } = require('rxjs');<br \/>const { map, filter } = require('rxjs\/operators');<br \/><br \/>const observable = from([1, 2, 3, 4, 5])<br \/>  .pipe(<br \/>    map ( x =&gt; x + 1),<br \/>    filter( x =&gt; x % 2 === 0),<br \/>    map( x =&gt; x - 1)<br \/>  );<br \/><br \/>observable.subscribe(<br \/>  val =&gt; console.log('odd:', val),<br \/>  error =&gt; console.error(error),<br \/>  () =&gt; console.log('complete')<br \/>);<\/pre>\n<p>The syntax looks like very familiar to the functional world where we have:<\/p>\n<ol>\n<li>Explicit subscription with Observable.subscribe;<\/li>\n<li>A set of operators;<\/li>\n<li>Observable and Pipeline operators are library-specific today but can become language-specific in the future;<\/li>\n<\/ol>\n<h2 id=\"ecf5c\">Reinventing RxJS<\/h2>\n<p>Let\u2019s explore RxJS by starting writing own operator. We will start with <strong>from<\/strong> operator to generate a stream of values.<\/p>\n<p>To be compliant with RxJS specification, take some initial data and return an object with the pipe <span id=\"urn:enhancement-4997e159\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span>. The pipe <span id=\"urn:enhancement-c04cc196\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> accepts a set of <span id=\"urn:enhancement-ea2264a4\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">functions<\/span> as parameters. We are going to use the rest operators from <span id=\"urn:enhancement-f061ccd6\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/ecmascript\">ES6<\/span> because we don\u2019t know how many <span id=\"urn:enhancement-e19703e2\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">functions<\/span> we will have. The output of the pipe is an Observable object with a subscribe <span id=\"urn:enhancement-d479a001\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> used for consuming it:<\/p>\n<pre><span id=\"urn:enhancement-6ecf9574\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> from(initialData) {<br \/>\u00a0 \u00a0 return {<br \/>    \u00a0 \u00a0 pipe(...pipeFunction) {<br \/>            return {<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 subscribe(onNext, onError, onComplete) {<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<br \/>\u00a0 \u00a0 \u00a0 \u00a0 }<br \/>    }<br \/>}<\/pre>\n<p>The subscribe <span id=\"urn:enhancement-e7875c38\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> has an object <span id=\"urn:enhancement-98265fd\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">called<\/span> dataObservable with a subscribe <span id=\"urn:enhancement-f11f802c\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> too, which takes the <span id=\"urn:enhancement-ccdb9961\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> that will be the <span id=\"urn:enhancement-6dc5414a\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> we pass to the subscribe <span id=\"urn:enhancement-5c9351e2\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> to take the emitted value. This innermost subscribe <span id=\"urn:enhancement-7a4bfad1\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span> emits the value with a forEach passing the next <span id=\"urn:enhancement-610698bc\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/method_computer_programming\">method<\/span>, in this case a simple console.log <span id=\"urn:enhancement-a6dec3fe\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span>. At this time we don\u2019t apply any pipe <span id=\"urn:enhancement-61675b27\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span>, we do it early.<\/p>\n<p>Before we move on and made our code more <span id=\"urn:enhancement-a95a093e\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/reusability\">reusable<\/span>, we must define a <span id=\"urn:enhancement-b7fe5602\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> called <em>createObservable<\/em>:<\/p>\n<pre><span id=\"urn:enhancement-42752edf\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> createObservable(operator) {<br \/>    return {<br \/>    \u00a0 \u00a0 subscribe(next) {<br \/>    \u00a0 \u00a0     operator(next);<br \/>    \u00a0 \u00a0 }<br \/>    }<br \/>}<\/pre>\n<figure class=\"image regular \"><picture><source srcset=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/MY-IMAGE_2_633178b01c96c2d30db9407ec1d16f41_800.jpg 1x\" media=\"(max-width: 768px)\" \/><source srcset=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/MY-IMAGE_2_633178b01c96c2d30db9407ec1d16f41_800.jpg 1x\" media=\"(min-width: 769px)\" \/><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/MY-IMAGE_2_633178b01c96c2d30db9407ec1d16f41_800.jpg\" alt=\"\" \/><\/picture>\n<figcaption>How Operators Works in RxJS<\/figcaption>\n<\/figure>\n<p>As we can see from the picture, RxJS can chain more than one operator, where we got an observable source and produce another observable for the next operator. So we have the previous, the current and the next observable. When we have to produce the next value, we want to apply a pipe <span id=\"urn:enhancement-832c0610\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span>, so we need to define it inside our from <span id=\"urn:enhancement-de347d8d\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span>:<\/p>\n<pre><span id=\"urn:enhancement-4238d191\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> from(initialData){<br \/>    return {<br \/>\u00a0 \u00a0 \u00a0 \u00a0 pipe: (...pipeFunctions) =&gt; {<br \/>             return {<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 subscribe: (onNext, onError, onComplete) =&gt; {<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0     const dataObservable = createObservable(x =&gt; initialData.forEach(x))<br \/><br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let currentObservable = dataObservable;<br \/><br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 pipeFunctions.forEach(pipeFunc =&gt; {<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 currentObservable = pipeFunc(currentObservable)<br \/>                    })<br \/><br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 currentObservable.subscribe(onNext);<br \/><br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 onComplete();<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<br \/>\u00a0 \u00a0 \u00a0 \u00a0     }<br \/>        }<br \/>    }<br \/>}<\/pre>\n<p>Now we can define our custom map and filter:<\/p>\n<pre><span id=\"urn:enhancement-7aae1c85\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> map(mapFunction){<br \/>    return sourceObservable =&gt; {<br \/>        const currentObservable = createObservable(destinationNext =&gt; {<br \/>            sourceObservable.subscribe(value =&gt; {<br \/>                const newValue = mapFunction(value)<br \/>                destinationNext(newValue);<br \/>            })<br \/>        })<br \/>        return currentObservable;<br \/>    }<br \/>}<br \/><br \/><span id=\"urn:enhancement-f4221a01\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> filter(filterFunction){<br \/>    return sourceObservable =&gt; {<br \/>        const currentObservable = createObservable(destinationNext =&gt; {<br \/>            sourceObservable.subscribe(value =&gt; {<br \/>                if(filterFunction(value)){<br \/>                    destinationNext(value);<br \/>                }<br \/>            })<br \/>        })<br \/>        return currentObservable;<br \/>    }<br \/>}<\/pre>\n<p>The filter <span id=\"urn:enhancement-b371ba0b\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> takes one parameter that returns a source observable, we construct the observable and subscribe to it where we need to check if my filter <span id=\"urn:enhancement-b5418062\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">function<\/span> of value is true and, if that is true, we get to the next destination with this value.<\/p>\n<p>So to recap, I create an observable from my initial data, I pipe all my <span id=\"urn:enhancement-e93244aa\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/subroutine\">functions<\/span> one with another, and at the end I subscribe to the final observable.<\/p>\n<p>So far, all that we see is synchronous, we don\u2019t talk about order and speed. How I can control the order and the speed of the emission of my value.<\/p>\n<p><span id=\"urn:enhancement-72c503c0\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/schedule\">Scheduler<\/span> in RxJS controls the order of event emissions and the speed of those event emissions.<\/p>\n<p>In RxJS we have five kinds of schedulers available, three of them are very useful and common: asyncScheduler, queueScheduler and asapScheduler.<\/p>\n<p>We can use Virtual <span id=\"urn:enhancement-eae692cf\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/schedule\">Scheduler<\/span> to control the speed of our Observable, especially in test ambient:<\/p>\n<pre>const { interval } = require('rxjs');<br \/>const { take, filter } = require('rxjs\/operators');<br \/><br \/>const source = interval(1000)<br \/>\u00a0 \u00a0 .pipe(take(3600));<br \/><br \/>source.subscribe(<br \/>\u00a0 \u00a0 console.log,<br \/>\u00a0 \u00a0 console.err,<br \/>() =&gt; console.log('--&gt; Completed!'),<br \/>);<br \/><br \/>console.log('--&gt; Subscribed!')<\/pre>\n<p>So, to better understand how something works under the hood, try to disassemble, simplify and challenge it by reinventing the wheel to learn &#8211; and please share it with us. Good luck!<\/p>\n<p><!-- strchf script --><script>        if(window.strchfSettings === undefined) window.strchfSettings = {};    window.strchfSettings.stats = {url: \"https:\/\/codemotion.storychief.io\/the-magic-behind-rxjs?id=775897454&type=2\",title: \"The Magic behind RxJS\",id: \"66543c6c-96d5-4792-a44b-49339654b7a1\"};            (function(d, s, id) {      var js, sjs = d.getElementsByTagName(s)[0];      if (d.getElementById(id)) {window.strchf.update(); return;}      js = d.createElement(s); js.id = id;      js.src = \"https:\/\/d37oebn0w9ir6a.cloudfront.net\/scripts\/v0\/strchf.js\";      js.async = true;      sjs.parentNode.insertBefore(js, sjs);    }(document, 'script', 'storychief-jssdk'))    <\/script><!-- End strchf script --><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>During Codemotion Rome 2019, Max Gallo performed a live coding session, showing how we can reverse engineer the RxJS library. RxJS is the Reactive Extensions for JavaScript language, which allows you to write reactive programs with a functional approach.<\/p>\n","protected":false},"author":79,"featured_media":2010,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[8],"tags":[4],"collections":[],"class_list":{"0":"post-2009","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript","8":"tag-codemotion-rome","9":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>The Magic behind RxJS - Codemotion<\/title>\n<meta name=\"description\" content=\"RxJS is the Reactive Extensions for JavaScript language, which allows you to write reactive programs with a functional approach.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Magic behind RxJS\" \/>\n<meta property=\"og:description\" content=\"RxJS is the Reactive Extensions for JavaScript language, which allows you to write reactive programs with a functional approach.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-10T11:07:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-23T14:30:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1198\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Lorenzo Franceschini\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lorenzo Franceschini\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/\"},\"author\":{\"name\":\"Lorenzo Franceschini\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/c48e30a376daa81f0b5099d3e0c16b04\"},\"headline\":\"The Magic behind RxJS\",\"datePublished\":\"2019-12-10T11:07:57+00:00\",\"dateModified\":\"2021-12-23T14:30:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/\"},\"wordCount\":1213,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg\",\"keywords\":[\"Codemotion Rome\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/\",\"name\":\"The Magic behind RxJS - Codemotion\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg\",\"datePublished\":\"2019-12-10T11:07:57+00:00\",\"dateModified\":\"2021-12-23T14:30:19+00:00\",\"description\":\"RxJS is the Reactive Extensions for JavaScript language, which allows you to write reactive programs with a functional approach.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg\",\"width\":1198,\"height\":675,\"caption\":\"The Magic behind RxJS\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/javascript\\\/the-magic-behind-rxjs\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Frontend\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Web Developer\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"The Magic behind RxJS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Codemotion.Italy\\\/\",\"https:\\\/\\\/x.com\\\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/c48e30a376daa81f0b5099d3e0c16b04\",\"name\":\"Lorenzo Franceschini\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/adfbaabe86bc433a00657b5827f9f5d47c1d66c20519afedcf67805ef30c9fb2?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/adfbaabe86bc433a00657b5827f9f5d47c1d66c20519afedcf67805ef30c9fb2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/adfbaabe86bc433a00657b5827f9f5d47c1d66c20519afedcf67805ef30c9fb2?s=96&d=mm&r=g\",\"caption\":\"Lorenzo Franceschini\"},\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/author\\\/lorenzo-franceschini\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"The Magic behind RxJS - Codemotion","description":"RxJS is the Reactive Extensions for JavaScript language, which allows you to write reactive programs with a functional approach.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/","og_locale":"en_US","og_type":"article","og_title":"The Magic behind RxJS","og_description":"RxJS is the Reactive Extensions for JavaScript language, which allows you to write reactive programs with a functional approach.","og_url":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2019-12-10T11:07:57+00:00","article_modified_time":"2021-12-23T14:30:19+00:00","og_image":[{"width":1198,"height":675,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg","type":"image\/jpeg"}],"author":"Lorenzo Franceschini","twitter_card":"summary_large_image","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Lorenzo Franceschini","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/"},"author":{"name":"Lorenzo Franceschini","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/c48e30a376daa81f0b5099d3e0c16b04"},"headline":"The Magic behind RxJS","datePublished":"2019-12-10T11:07:57+00:00","dateModified":"2021-12-23T14:30:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/"},"wordCount":1213,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg","keywords":["Codemotion Rome"],"articleSection":["JavaScript"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/","url":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/","name":"The Magic behind RxJS - Codemotion","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg","datePublished":"2019-12-10T11:07:57+00:00","dateModified":"2021-12-23T14:30:19+00:00","description":"RxJS is the Reactive Extensions for JavaScript language, which allows you to write reactive programs with a functional approach.","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg","width":1198,"height":675,"caption":"The Magic behind RxJS"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/the-magic-behind-rxjs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"Frontend","item":"https:\/\/www.codemotion.com\/magazine\/frontend\/"},{"@type":"ListItem","position":3,"name":"Web Developer","item":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/"},{"@type":"ListItem","position":4,"name":"The Magic behind RxJS"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/c48e30a376daa81f0b5099d3e0c16b04","name":"Lorenzo Franceschini","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/adfbaabe86bc433a00657b5827f9f5d47c1d66c20519afedcf67805ef30c9fb2?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/adfbaabe86bc433a00657b5827f9f5d47c1d66c20519afedcf67805ef30c9fb2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/adfbaabe86bc433a00657b5827f9f5d47c1d66c20519afedcf67805ef30c9fb2?s=96&d=mm&r=g","caption":"Lorenzo Franceschini"},"url":"https:\/\/www.codemotion.com\/magazine\/author\/lorenzo-franceschini\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-600x400.jpg","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-600x600.jpg","author_info":{"display_name":"Lorenzo Franceschini","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/lorenzo-franceschini\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg",1198,675,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-150x150.jpg",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-768x433.jpg",768,433,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-1024x577.jpg",1024,577,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg",1198,675,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg",1198,675,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000.jpg",100,56,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-180x128.jpg",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-896x504.jpg",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-400x225.jpg",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-600x400.jpg",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/12\/D2QwCpvXcAE1xlV_7c73d53814f30ce280aeb7f86c2b37ec_2000-600x600.jpg",600,600,true]},"uagb_author_info":{"display_name":"Lorenzo Franceschini","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/lorenzo-franceschini\/"},"uagb_comment_info":0,"uagb_excerpt":"During Codemotion Rome 2019, Max Gallo performed a live coding session, showing how we can reverse engineer the RxJS library. RxJS is the Reactive Extensions for JavaScript language, which allows you to write reactive programs with a functional approach.","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/2009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=2009"}],"version-history":[{"count":1,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/2009\/revisions"}],"predecessor-version":[{"id":2889,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/2009\/revisions\/2889"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/2010"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=2009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=2009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=2009"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=2009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}