我有一个返回promise的函数:
Setup.zoomIn() : Promise<void> {...}
我想使用rxjs调用该函数5次,每次延迟1秒,如下所示:
let obs = Observable.create(observer => {
let count = 0;
setTimeout(() => {
Setup.zoomIn();
count++;
observer.next();
}, 1000);
if (count === 5) {observer.complete();}
};
obs.subscribe(() =>
console.log('zoomed out');
)};
仅在执行该操作时,我希望继续执行以执行进一步的步骤:
obs.toPromise.then(() => {
// do some stuff here but only after zoom has been invoked 5 times
})
答案 0 :(得分:0)
为zoomIns函数创建一个observable列表,并将它们与另一个Observable连接起来。
select sum(value) as summed_value from series where time> now() - 2400h and time<now() - 1200h;