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 mins if the condition if(model['isActivated']) is not satisfied. However if the condition satisfies I can stop it manually. Not sure if the manual stop is still correct in this case.
Any suggestions with other timer functions are also appreciated.