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 {MapService} from '../../service/map.service';
|
||||||
|
import * as internal from 'events';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-auto-refresh',
|
selector: 'app-auto-refresh',
|
||||||
templateUrl: './auto-refresh.component.html',
|
templateUrl: './auto-refresh.component.html',
|
||||||
styleUrls: ['./auto-refresh.component.scss']
|
styleUrls: ['./auto-refresh.component.scss']
|
||||||
})
|
})
|
||||||
export class AutoRefreshComponent implements OnInit {
|
export class AutoRefreshComponent implements OnInit, OnDestroy {
|
||||||
isFlagActive: boolean;
|
isFlagActive: boolean;
|
||||||
|
interval: internal;
|
||||||
|
|
||||||
constructor(private map: MapService) {
|
constructor(private map: MapService) {
|
||||||
const storageFlag = JSON.parse(sessionStorage.getItem('auto-refresh'));
|
const storageFlag = JSON.parse(sessionStorage.getItem('auto-refresh'));
|
||||||
@ -19,15 +21,19 @@ export class AutoRefreshComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
setInterval(() => {
|
this.interval = setInterval(() => {
|
||||||
if (this.isFlagActive) {
|
if (this.isFlagActive) {
|
||||||
this.map.autoRefresh();
|
this.map.autoRefresh();
|
||||||
}
|
}
|
||||||
}, 30000);
|
}, 30000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
clearInterval(this.interval);
|
||||||
|
}
|
||||||
|
|
||||||
onChange(flag: boolean): void {
|
onChange(flag: boolean): void {
|
||||||
sessionStorage.setItem('auto-refresh', JSON.stringify(flag));
|
sessionStorage.setItem('auto-refresh', JSON.stringify(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user