随笔分类 - RxJS
摘要:Often you only want values to proceed through your stream if they meet certain criteria, just as if you were using an if statement in plain JavaScript
阅读全文
posted @ 2016-03-11 15:30
Zhentiw
摘要:Two streams often need to work together to produce the values you’ll need. This lesson shows how to use an input stream and an interval stream togethe
阅读全文
posted @ 2016-03-11 04:17
Zhentiw
摘要:By default, Inputs will push input events into the stream. This lesson shows you how to use map to convert the input event into the text you actually
阅读全文
posted @ 2016-03-11 03:37
Zhentiw
摘要:Refactoring streams in RxJS is mostly moving pieces of smaller streams around. This lessons demonstrates a simple refactoring by requiring the StopWat
阅读全文
posted @ 2016-03-11 03:34
Zhentiw
摘要:You often need to handle multiple user interactions set to different streams. This lesson shows hows Observable.merge behaves like a "logical OR" to h
阅读全文
posted @ 2016-03-11 00:27
Zhentiw
摘要:So now we want to replace one user when we click the 'x' button. To do that, we want: 1. Get the cached network data for generating the userList. 2. T
阅读全文
posted @ 2016-03-10 02:39
Zhentiw
摘要:You often need streams to trigger different behaviors on the data based on which streams triggers. This lessons shows how to use mapTo to pass functio
阅读全文
posted @ 2016-03-09 22:38
Zhentiw
摘要:You often need to render out data before you stream begins from a click or another user interaction. This lessons shows how to use startWith to set th
阅读全文
posted @ 2016-03-09 16:58
Zhentiw
摘要:You often need to update the data flowing through the stream with custom logic based on what you need to output. This lesson covers how to use scan fo
阅读全文
posted @ 2016-03-09 16:47
Zhentiw
摘要:Observables often need to be stopped before they are completed. This lesson shows how to use takeUntil to stop a running timer. Then we use the starti
阅读全文
posted @ 2016-03-09 16:32
Zhentiw
摘要:Currently we show three users in the list, it actually do three time network request, we can verfiy this by console out each network request: var resp
阅读全文
posted @ 2016-03-09 03:31
Zhentiw
摘要:In currently implemention, there is one problem, when the page load and click refresh button, the user list is not immediatly clean up,it is cleared a
阅读全文
posted @ 2016-03-09 03:18
Zhentiw
摘要:Now we want each time we click refresh button, we will get new group of users. So we need to get the refresh button click event stream: var refreshBut
阅读全文
posted @ 2016-03-08 19:31
Zhentiw
摘要:From an event map to another event we can use switchMap(), switchMap() accept an function which return an obervable. The following code: When you clic
阅读全文
posted @ 2016-03-08 03:34
Zhentiw
摘要:<!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-1.7.2.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs
阅读全文
posted @ 2016-03-08 03:15
Zhentiw
摘要:RxJS is super when dealing with the dynamic value. Let's see an example which not using RxJS: var a = 4; var b = a * 10; console.log(b); // 40 a = 5;
阅读全文
posted @ 2016-03-08 01:25
Zhentiw
摘要:First thing need to understand is, Reactive programming is dealing with the event stream. Event streams happens overtime, which not stay in the memory
阅读全文
posted @ 2016-03-07 19:54
Zhentiw
摘要:Sometimes, the helper methods that RxJS ships with such as fromEvent, fromPromise etc don't always provide the exact values you want & you end up havi
阅读全文
posted @ 2016-02-25 15:50
Zhentiw
摘要:When doing search function, you always need to consider about the concurrent requests. AEvent ----(6s)---> AResult ------(100ms)------- BEvent -----(1
阅读全文
posted @ 2016-02-08 21:39
Zhentiw
摘要:How can we show one string on the DOM, and a completely different string on Console log? This lesson shows how we can make our main function return mu
阅读全文
posted @ 2016-02-02 07:00
Zhentiw