mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Refactoring made on offline
This commit is contained in:
@@ -5,6 +5,12 @@ import { Injectable } from '@angular/core';
|
||||
})
|
||||
export class BackgroundService {
|
||||
|
||||
callBacks: {
|
||||
type: 'Offline' | 'Online',
|
||||
object?: string
|
||||
funx: Function
|
||||
}[] = []
|
||||
|
||||
constructor() { }
|
||||
|
||||
online() {
|
||||
@@ -13,6 +19,11 @@ export class BackgroundService {
|
||||
document.body.style.setProperty(`--color3`, "#0782C9");
|
||||
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
||||
document.body.style.setProperty(`--color5`, "#45BAFF");
|
||||
this.callBacks.forEach((e) => {
|
||||
if (e.type == 'Online') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
offline() {
|
||||
@@ -21,5 +32,18 @@ export class BackgroundService {
|
||||
document.body.style.setProperty(`--color3`, "#ffb703");
|
||||
document.body.style.setProperty(`--color4`, "#ffb703");
|
||||
document.body.style.setProperty(`--color5`, "#ffb703");
|
||||
this.callBacks.forEach((e) => {
|
||||
if (e.type == 'Offline') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
registerBackService(type: 'Offline' | 'Online', funx: Function, object = '') {
|
||||
this.callBacks.push({
|
||||
type,
|
||||
funx,
|
||||
object
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user