public function(id: number) {
this.periodicCheckTimer = Observable.timer(10000, 5000).subscribe(
() => {
let model = this.find(id);
if (model['isActivated']) {
this.periodicCheckTimer.unsubscribe();
}
});
}
I want to stop the timer automatically after 5 minutes if the condition if (model ['isActivated']) is not fulfilled. However, if the condition is satisfied, I can stop it manually. Not sure if manual stop in this case is still correct.
Any suggestions with other timer functions are also welcome.
source
share