Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70745

How close an object depending of a connection status subscribe in another service?

$
0
0

@temohpab wrote:

Hi, i have a service who checks if an internet connection is active:

serviceconnection

    this.connected = this.network.onDisconnect().subscribe(() => {
      console.log('you are offline');
      this.presentConfirm();
    });

    this.disconnected = this.network.onConnect().subscribe(()=> {
      console.log('you are online');
    });

 presentConfirm(){
    let vm = this;
    if(!vm.alertPresented) {
      vm.alertPresented = true
      vm.alertCtrl.create({
        title: 'Advertencia',
        subTitle: 'No internet',
        enableBackdropDismiss: false,
        buttons: [{
          text: 'Reintentar',
          handler: () => {
            vm.alertPresented = false;
            setTimeout(()=>{
              if(this.checkConnection() == false){
                this.presentConfirm();
              }
            }, 400);
          }
        }],
      }).present();
    }
  }

If i have an opened object in another TS (for example an InAppBrowser window)… How can i close it if internet doesn’t exists?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70745

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>