我正在使用我的第一个Angular 2产品。我创建了这个Observable.timer,然后订阅它。它轮询服务器的数据。如何在Angular 2中暂停Observable 2
我的问题
如何暂停及恢复呢?
ngOnInit(): void {
this.poll = Observable.timer(500,500).subscribe((t: any) => {
this.request.getRackList(+this.global.zoneId).subscribe(
incoming => this.import(incoming),
err => { this.global.err(err) }
);
})
this.canOpenClose = (this.global.mode === 2);
}
更换
publishReplay
替代这里https://github.com/ReactiveX/rxjs/issues/1542描述 – martin