From 006f7dc2ade093ccae083fe09c5efb9240f1bad9 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 28 Mar 2017 09:07:12 -0400 Subject: [PATCH] fix(network): fix onchange method fixes #1173 --- src/@ionic-native/plugins/network/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/network/index.ts b/src/@ionic-native/plugins/network/index.ts index fb33619e75..58a7257b76 100644 --- a/src/@ionic-native/plugins/network/index.ts +++ b/src/@ionic-native/plugins/network/index.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; -import {Cordova, CordovaProperty, Plugin, CordovaFunctionOverride} from '@ionic-native/core'; +import { Cordova, CordovaProperty, Plugin, CordovaCheck } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; +import 'rxjs/observable/merge'; declare var navigator: any; @@ -75,8 +76,10 @@ export class Network { * Returns an observable to watch connection changes * @return {Observable} */ - @CordovaFunctionOverride() - onchange(): Observable { return; } + @CordovaCheck() + onchange(): Observable { + return Observable.merge(this.onConnect(), this.onDisconnect()); + } /** * Get notified when the device goes offline