You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2017/01/20 08:46:11 UTC

cordova-plugin-network-information git commit: CB-12369: Add plugin typings from DefinitelyTyped

Repository: cordova-plugin-network-information
Updated Branches:
  refs/heads/master 30e219aa9 -> d8c1b0b50


CB-12369: Add plugin typings from DefinitelyTyped

 This closes #53


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/commit/d8c1b0b5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/tree/d8c1b0b5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/diff/d8c1b0b5

Branch: refs/heads/master
Commit: d8c1b0b503e349b61274dab39fae14241d40f14e
Parents: 30e219a
Author: Nikita Matrosov <v-...@microsoft.com>
Authored: Thu Jan 19 16:10:44 2017 +0300
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Fri Jan 20 11:46:00 2017 +0300

----------------------------------------------------------------------
 package.json     |  1 +
 types/index.d.ts | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/d8c1b0b5/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 3457a51..a87f6cd 100644
--- a/package.json
+++ b/package.json
@@ -2,6 +2,7 @@
   "name": "cordova-plugin-network-information",
   "version": "1.3.2-dev",
   "description": "Cordova Network Information Plugin",
+  "types": "./types/index.d.ts",
   "cordova": {
     "id": "cordova-plugin-network-information",
     "platforms": [

http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/d8c1b0b5/types/index.d.ts
----------------------------------------------------------------------
diff --git a/types/index.d.ts b/types/index.d.ts
new file mode 100644
index 0000000..60b6c26
--- /dev/null
+++ b/types/index.d.ts
@@ -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;
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org