mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add synchro callbacks
This commit is contained in:
@@ -81,11 +81,14 @@ class SynchroService {
|
||||
|
||||
this.BackgroundService.online()
|
||||
|
||||
this.callBacks.forEach((e)=>{
|
||||
if(e.type == 'Online') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
if(!this.conected) {
|
||||
this.callBacks.forEach((e)=>{
|
||||
if(e.type == 'Online') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
console.log('open ======================= welcome to socket server')
|
||||
this._connected = true
|
||||
@@ -169,13 +172,16 @@ class SynchroService {
|
||||
console.log('[close] Connection died');
|
||||
console.log('Reconnect')
|
||||
|
||||
this.BackgroundService.offline();
|
||||
|
||||
|
||||
this.callBacks.forEach((e)=>{
|
||||
if(e.type == 'Offline') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
if(this._connected) {
|
||||
this.BackgroundService.offline();
|
||||
this.callBacks.forEach((e)=>{
|
||||
if(e.type == 'Offline') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// status
|
||||
this._connected = false
|
||||
|
||||
Reference in New Issue
Block a user