Besides converting arrays and promises to Observables, we can also convert other structures to Observables. This lesson teaches how we can convert any addEventHandler/removeEventHandler API to Observables.  fromEvent(target, EventType): var foo = Rx.…
It is quite common to need an Observable that ticks periodically, for instance every second or every 100 miliseconds. We will learn about operators interval() and timer(), both of which are similar to setInterval() in JavaScript. Interval(period): Yo…
This lesson introduces operators empty(), never(), and throw(), which despite being plain and void of functionality, are very useful when combining with other Observables. empty: var foo = Rx.Observable.empty(); // the same as var foo = Rx.Observable…
The of() operator essentially converted a list of arguments to an Observable. Since arrays are often how we structure list of things in JavaScript, we should have a way of transforming arrays into Observables. This lesson teaches how you can convert…
RxJS is a lot about the so-called "operators". We will learn most of the important operators, one by one. In this lesson, we will see our first creation operator: of(). var foo = Rx.Observable.of(42, 100, 200); // var bar = Rx.Observable.create(…
We have been using Observable.create() a lot in previous lessons, so let's take a closer look how does it work. The create function: var foo = Rx.Observable.create( function(observer){ observer.next(); observer.next(); observer.next(); observer.compl…
本文使用的是angular6内置的rxjs,版本号为6.3.3 concat 通过顺序地发出多个 Observables 的值将它们连接起来,一个接一个的. 参数: 名称 类型 属性 描述 other ObservableInput 等待被连接的 Observable. 可以接受多个输入 Observable. scheduler Scheduler 可选的,默认值: null 可选的调度器,控制每个输入 Observable 的订阅. const timer1 = interval(1000)…
Debounce and debounceTime operators are similar to delayWhen and delay, with the difference that they may drop some emissions. This lesson teaches you how debounce works and where is it useful, for instance when building a type-ahead UI. debounceTime…
This lessons teaches about delay and delayWhen: simple operators that time shift. delay(number | date) var foo = Rx.Observable.interval(500).take(5); /* --0--1--2--3--4| delay(1000) -----0--1--2--3--4| */ // delay(1000) var result = foo.delay(1000);…
After takeUntil() and takeWhile() function, let's have a look on skipWhile() and skilUntil() functions. SkipWhile(predicate: function): Skip the value if meet the predicate function. var foo = Rx.Observable.interval(1000); /* --0--1--2--3--4--5--6--7…