]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/timer.service.ts
import ceph quincy 17.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / services / timer.service.ts
index 2ae2f4cdf5ebc2624266852796aa340229836127..716b710968f339963a4fb69ba063cb2c1a6d8dc8 100644 (file)
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
 import { Observable, timer } from 'rxjs';
 import { observeOn, shareReplay, switchMap } from 'rxjs/operators';
 
+import { whenPageVisible } from '../rxjs/operators/page-visibilty.operator';
 import { NgZoneSchedulerService } from './ngzone-scheduler.service';
 
 @Injectable({
@@ -21,7 +22,8 @@ export class TimerService {
     return timer(dueTime, refreshInterval, this.ngZone.leave).pipe(
       observeOn(this.ngZone.enter),
       switchMap(next),
-      shareReplay({ refCount: true, bufferSize: 1 })
+      shareReplay({ refCount: true, bufferSize: 1 }),
+      whenPageVisible()
     );
   }
 }