mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
save
This commit is contained in:
@@ -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 {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user