From ae295766d2060b0c1ab5dafe3087cbd652d36b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=83=E4=BA=AE=E6=96=8C?= Date: Thu, 8 Jul 2021 10:51:36 +0800 Subject: [PATCH] window.md: using source directly instead of mergeAll There is no difference between `example.pipe(mergeAll())` and `source` https://jsbin.com/sodaguyini/edit?js,console --- operators/transformation/window.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/operators/transformation/window.md b/operators/transformation/window.md index 320a86d..aaaea5c 100644 --- a/operators/transformation/window.md +++ b/operators/transformation/window.md @@ -16,7 +16,7 @@ ```js // RxJS v6+ import { timer, interval } from 'rxjs'; -import { window, scan, mergeAll } from 'rxjs/operators'; +import { window, scan } from 'rxjs/operators'; // 立即发出值,然后每秒发出值 const source = timer(0, 1000); @@ -34,9 +34,7 @@ const count = example.pipe(scan((acc, curr) => acc + 1, 0)); ... */ const subscribe = count.subscribe(val => console.log(`Window ${val}:`)); -const subscribeTwo = example - .pipe(mergeAll()) - .subscribe(val => console.log(val)); +const subscribeTwo = source.subscribe(val => console.log(val)); ``` ### 其他资源