mea culpa mi dominus
This commit is contained in:
parent
c05ee5388e
commit
f5924404a7
@ -1,13 +1,15 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {MapService} from '../../service/map.service';
|
||||
import * as internal from 'events';
|
||||
|
||||
@Component({
|
||||
selector: 'app-auto-refresh',
|
||||
templateUrl: './auto-refresh.component.html',
|
||||
styleUrls: ['./auto-refresh.component.scss']
|
||||
})
|
||||
export class AutoRefreshComponent implements OnInit {
|
||||
export class AutoRefreshComponent implements OnInit, OnDestroy {
|
||||
isFlagActive: boolean;
|
||||
interval: internal;
|
||||
|
||||
constructor(private map: MapService) {
|
||||
const storageFlag = JSON.parse(sessionStorage.getItem('auto-refresh'));
|
||||
@ -19,15 +21,19 @@ export class AutoRefreshComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
setInterval(() => {
|
||||
this.interval = setInterval(() => {
|
||||
if (this.isFlagActive) {
|
||||
this.map.autoRefresh();
|
||||
}
|
||||
}, 30000);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
|
||||
onChange(flag: boolean): void {
|
||||
sessionStorage.setItem('auto-refresh', JSON.stringify(flag));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user