You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ni...@apache.org on 2016/05/18 19:10:00 UTC
cordova-plugin-network-information git commit: Readme: Add fenced
code blocks with langauage hints
Repository: cordova-plugin-network-information
Updated Branches:
refs/heads/master bc8923ffe -> 808a2a71d
Readme: Add fenced code blocks with langauage hints
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/808a2a71
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/tree/808a2a71
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/diff/808a2a71
Branch: refs/heads/master
Commit: 808a2a71d99f6f8efe832019a089d19119340871
Parents: bc8923f
Author: Nikhil Khandelwal <ni...@microsoft.com>
Authored: Wed May 18 12:09:41 2016 -0700
Committer: Nikhil Khandelwal <ni...@microsoft.com>
Committed: Wed May 18 12:09:41 2016 -0700
----------------------------------------------------------------------
README.md | 56 +++++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/808a2a71/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index f00c1b9..e3a674f 100644
--- a/README.md
+++ b/README.md
@@ -79,24 +79,25 @@ connection state, and type of connection.
### Quick Example
- function checkConnection() {
- var networkState = navigator.connection.type;
-
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
-
- alert('Connection type: ' + states[networkState]);
- }
+```js
+function checkConnection() {
+ var networkState = navigator.connection.type;
- checkConnection();
+ var states = {};
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+
+ alert('Connection type: ' + states[networkState]);
+}
+checkConnection();
+```
### API Change
@@ -158,12 +159,13 @@ attach an event listener once the `deviceready` event fires.
### Quick Example
- document.addEventListener("offline", onOffline, false);
-
- function onOffline() {
- // Handle the offline event
- }
+```js
+document.addEventListener("offline", onOffline, false);
+function onOffline() {
+ // Handle the offline event
+}
+```
### iOS Quirks
@@ -197,12 +199,13 @@ attach an event listener once the `deviceready` event fires.
### Quick Example
- document.addEventListener("online", onOnline, false);
-
- function onOnline() {
- // Handle the online event
- }
+```js
+document.addEventListener("online", onOnline, false);
+function onOnline() {
+ // Handle the online event
+}
+```
### iOS Quirks
@@ -227,7 +230,6 @@ To start with, create a new FileEntry object (data.txt) to use for sample data.
>*Note* This code example requires the File plugin.
```js
-
var dataFileEntry;
function createSomeData() {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org