Whenever any input Observable emits a value, it computes a formula using the latest values from all the inputs, then emits the output of that formula.
这个图的一些解释:
看个例子:
const firstTimer = timer(0, 1000); // emit 0, 1, 2... after every second, starting from now
const secondTimer = timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now
const combinedTimers = combineLatest(firstTimer, secondTimer);
combinedTimers.subscribe(value => console.log('diablo: '
+ value));
测试结果:
时间轴分析:
要获取更多Jerry的原创文章,请关注公众号"汪子熙":