mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-04-13 00:00:10 +08:00
Merge branch 'master' into v5
This commit is contained in:
@@ -10,6 +10,17 @@ import { Observable, merge } from 'rxjs';
|
||||
|
||||
declare const navigator: any;
|
||||
|
||||
export enum Connection {
|
||||
UNKNOWN = 0,
|
||||
ETHERNET,
|
||||
WIFI,
|
||||
CELL_2G,
|
||||
CELL_3G ,
|
||||
CELL_4G,
|
||||
CELL,
|
||||
NONE
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Network
|
||||
* @description
|
||||
@@ -23,7 +34,7 @@ declare const navigator: any;
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // watch network for a disconnect
|
||||
* // watch network for a disconnection
|
||||
* let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
|
||||
* console.log('network was disconnected :-(');
|
||||
* });
|
||||
@@ -61,6 +72,21 @@ declare const navigator: any;
|
||||
})
|
||||
@Injectable()
|
||||
export class Network extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Constants for possible connection types
|
||||
*/
|
||||
Connection = {
|
||||
UNKNOWN: 'unknown',
|
||||
ETHERNET: 'ethernet',
|
||||
WIFI: 'wifi',
|
||||
CELL_2G: '2g',
|
||||
CELL_3G: '3g',
|
||||
CELL_4G: '4g',
|
||||
CELL: 'cellular',
|
||||
NONE: 'none'
|
||||
};
|
||||
|
||||
/**
|
||||
* Connection type
|
||||
* @return {string}
|
||||
|
||||
Reference in New Issue
Block a user