Skip to content

Commit

Permalink
feat(network): update Network plugin (#3608)
Browse files Browse the repository at this point in the history
Extends onChange Observable with types of connection to which it changed
  • Loading branch information
timkovik committed Apr 5, 2021
1 parent 2f69dd8 commit 31ee7ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/@ionic-native/plugins/network/index.ts
Expand Up @@ -95,11 +95,11 @@ export class Network extends IonicNativePlugin {

/**
* Returns an observable to watch connection changes
* @return {Observable<any>}
* @return {Observable<'connected' | 'disconnected'>}
*/
@CordovaCheck()
onChange(): Observable<any> {
return merge(this.onConnect(), this.onDisconnect());
onChange(): Observable<'connected' | 'disconnected'> {
return merge(this.onConnect().pipe(mapTo('connected')), this.onDisconnect().pipe(mapTo('disconnected'));
}

/**
Expand Down

0 comments on commit 31ee7ef

Please sign in to comment.