From fd3e14282b91d7cc58c6755d16d49413b899c135 Mon Sep 17 00:00:00 2001 From: fivge Date: Sat, 13 Jun 2020 16:52:47 +0800 Subject: [PATCH] fix(operators): transformation/switchmap.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit interval(500)是先等待500ms再发出流,timer(0, 5000)在5000ms内,有9个流发出。所以输出应该是0,1,2,3,4,5,6,7,8 --- operators/transformation/switchmap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operators/transformation/switchmap.md b/operators/transformation/switchmap.md index bea75f4..2c65cb0 100644 --- a/operators/transformation/switchmap.md +++ b/operators/transformation/switchmap.md @@ -42,7 +42,7 @@ import { switchMap } from 'rxjs/operators'; const source = timer(0, 5000); // 当 source 发出值时切换到新的内部 observable,发出新的内部 observable 所发出的值 const example = source.pipe(switchMap(() => interval(500))); -// 输出: 0,1,2,3,4,5,6,7,8,9...0,1,2,3,4,5,6,7,8 +// 输出: 0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8...0,1,2,3,4,5,6,7,8 const subscribe = example.subscribe(val => console.log(val)); ```