This commit is contained in:
Peter Maquiran
2023-01-09 17:07:02 +01:00
parent efa7774c1c
commit 58f9e7eacd
10 changed files with 62 additions and 32 deletions
+12 -4
View File
@@ -15,6 +15,8 @@ export class BackgroundService {
funx: Function
}[] = []
status: 'online'| 'offline' = 'online'
constructor(
private themeservice: ThemeService,
private storageservice: StorageService,
@@ -22,14 +24,18 @@ export class BackgroundService {
) { }
online() {
if(this.status == 'online') {
return false
}
this.status = 'online'
this.paint()
this.callBacks.forEach((e) => {
if (e.type == 'Online') {
e.funx()
}
})
this.status = 'offline'
}
paint() {
@@ -59,6 +65,10 @@ export class BackgroundService {
async offline() {
if(this.status == 'offline') {
return false
}
let opts = {
headers: {},
}
@@ -68,6 +78,7 @@ export class BackgroundService {
} catch (error) {
if(error.status != 400) {
this.status = 'offline'
document.body.style.setProperty(`--color`, "#ffb703");
document.body.style.setProperty(`--color2`, "#ffb703");
document.body.style.setProperty(`--color3`, "#ffb703");
@@ -82,8 +93,6 @@ export class BackgroundService {
}
}
}
registerBackService(type: 'Offline' | 'Online' | 'Notification', funx: Function, object = '') {
@@ -94,5 +103,4 @@ export class BackgroundService {
})
}
}
+5 -1
View File
@@ -21,7 +21,11 @@ export class NetworkServiceService {
this.initializeNetworkEvents();
let status = this.network.type !== 'none' ? ConnectionStatus.Online : ConnectionStatus.Offline;
this.status.next(status);
});
});
this.onNetworkChange().subscribe((status) => {
console.log(status)
})
}