Improve counting

This commit is contained in:
Peter Maquiran
2021-07-20 08:51:29 +01:00
parent 590d7d8139
commit a46474e0aa
4 changed files with 39 additions and 36 deletions
+12 -12
View File
@@ -10,12 +10,13 @@ import { LocalstoreService } from './localstore.service'
export class CalendarService {
private _eventSource : eventSource[] = []
private keyName: string;
constructor(localstoreService: LocalstoreService) {
constructor(private localstoreService: LocalstoreService) {
const keyName = (SHA1(this.constructor.name+ 'eventSource')).toString()
this.keyName = (SHA1(this.constructor.name+ 'eventSource')).toString()
let restore = localstoreService.get(keyName, [])
let restore = localstoreService.get(this.keyName, [])
setTimeout(()=>{
restore.forEach((element, eventIndex) => {
@@ -31,15 +32,7 @@ export class CalendarService {
});
});
},1)
setTimeout(() => {
setInterval(()=> {
localstoreService.set(keyName, this._eventSource)
}, 5000)
}, 10000)
},10)
}
@@ -85,6 +78,13 @@ export class CalendarService {
this._eventSource = (filtered)
setTimeout(() => {
this.localstoreService.set(this.keyName, this._eventSource)
}, 10)
}
}