Inicio page is offline

This commit is contained in:
Eudes Inácio
2021-09-21 06:09:41 +01:00
parent 7fdb16c272
commit 42ae5de817
15 changed files with 702 additions and 437 deletions
+11 -4
View File
@@ -3,6 +3,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { v4 as uuidv4 } from 'uuid'
import { BackgroundService } from '../background.service';
import { environment } from 'src/environments/environment';
import { EventTrigger } from '../eventTrigger.service'
export interface wss{
@@ -28,6 +29,7 @@ class SynchroService {
private url: string = ''
callback = function(){}
private _connected = false;
private eventtrigger: EventTrigger;
private BackgroundService = new BackgroundService()
callBacks: {
type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notification' | 'Notifications' | '',
@@ -81,7 +83,7 @@ class SynchroService {
if(!this.conected) {
//if(!this._connected) {
this.BackgroundService.online()
this.callBacks.forEach((e)=>{
@@ -90,9 +92,13 @@ class SynchroService {
}
})
}
//}
console.log('open ======================= welcome to socket server')
this.eventtrigger.publishSomeData({
internet: "online"
})
this._connected = true
// send all saved data due to internet connection
@@ -177,14 +183,15 @@ class SynchroService {
if(this._connected) {
// if(this._connected){
this.BackgroundService.offline();
this.callBacks.forEach((e)=>{
if(e.type == 'Offline') {
e.funx()
}
})
}
//}
// status
this._connected = false