在 Observable 裡做 recursive 操作
請參考 expand operator 的說明: Recursively projects each source value to an Observable which is merged in the output Observable. 在 expand operator 裡主要的判斷是如果離開這個 recursion 就回傳 Rx.Observable.empty();反之就把需要 recursive 的值修改後再回傳 Observable 物件,於是你的 Observable 物件就可以做類似 loop 的叫用串接了。 小範例如下,是用 AVA 做 test runner: const Rx = require('rxjs'); const winston = require('winston'); const test = require('ava'); const fetchObs = (count) => { return Rx.Observable.of({value: count, count: count*2}); }; test('test expand', (t) => { return fetchObs(1) ....