mirror of
https://gitee.com/shuto/cordova-plugin-network-information.git
synced 2025-01-18 13:42:49 +08:00
parent
30e219aa95
commit
d8c1b0b503
@ -2,6 +2,7 @@
|
|||||||
"name": "cordova-plugin-network-information",
|
"name": "cordova-plugin-network-information",
|
||||||
"version": "1.3.2-dev",
|
"version": "1.3.2-dev",
|
||||||
"description": "Cordova Network Information Plugin",
|
"description": "Cordova Network Information Plugin",
|
||||||
|
"types": "./types/index.d.ts",
|
||||||
"cordova": {
|
"cordova": {
|
||||||
"id": "cordova-plugin-network-information",
|
"id": "cordova-plugin-network-information",
|
||||||
"platforms": [
|
"platforms": [
|
||||||
|
62
types/index.d.ts
vendored
Normal file
62
types/index.d.ts
vendored
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// Type definitions for Apache Cordova Network Information plugin
|
||||||
|
// Project: https://github.com/apache/cordova-plugin-network-information
|
||||||
|
// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
//
|
||||||
|
// Copyright (c) Microsoft Open Technologies Inc
|
||||||
|
// Licensed under the MIT license
|
||||||
|
|
||||||
|
interface Navigator {
|
||||||
|
/**
|
||||||
|
* This plugin provides an implementation of an old version of the Network Information API.
|
||||||
|
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
|
||||||
|
*/
|
||||||
|
connection: Connection;
|
||||||
|
// see https://github.com/apache/cordova-plugin-network-information/blob/dev/doc/index.md#api-change
|
||||||
|
// for
|
||||||
|
network: {
|
||||||
|
/**
|
||||||
|
* This plugin provides an implementation of an old version of the Network Information API.
|
||||||
|
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
|
||||||
|
*/
|
||||||
|
connection: Connection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Document {
|
||||||
|
addEventListener(type: "online", connectionStateCallback: () => any, useCapture?: boolean): void;
|
||||||
|
addEventListener(type: "offline", connectionStateCallback: () => any, useCapture?: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The connection object, exposed via navigator.connection, provides information
|
||||||
|
* about the device's cellular and wifi connection.
|
||||||
|
*/
|
||||||
|
interface Connection {
|
||||||
|
/**
|
||||||
|
* This property offers a fast way to determine the device's network connection state, and type of connection.
|
||||||
|
* One of:
|
||||||
|
* Connection.UNKNOWN
|
||||||
|
* Connection.ETHERNET
|
||||||
|
* Connection.WIFI
|
||||||
|
* Connection.CELL_2G
|
||||||
|
* Connection.CELL_3G
|
||||||
|
* Connection.CELL_4G
|
||||||
|
* Connection.CELL
|
||||||
|
* Connection.NONE
|
||||||
|
*/
|
||||||
|
type: string;
|
||||||
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||||
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var Connection: {
|
||||||
|
UNKNOWN: string;
|
||||||
|
ETHERNET: string;
|
||||||
|
WIFI: string;
|
||||||
|
CELL_2G: string;
|
||||||
|
CELL_3G: string;
|
||||||
|
CELL_4G: string;
|
||||||
|
CELL: string;
|
||||||
|
NONE: string;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user