cordova-plugin-progress
Advanced tools
Sorry, the diff of this file is too big to display
+1
-1
| { | ||
| "name": "cordova-plugin-progress", | ||
| "version": "0.0.2", | ||
| "version": "0.1.1", | ||
| "author": "Lee Crossley <leee@hotmail.co.uk> (http://ilee.co.uk/)", | ||
@@ -5,0 +5,0 @@ "description": "Cordova / PhoneGap Plugin for Progress HUD Notifications via KVNProgress", |
+1
-1
| <?xml version='1.0' encoding='UTF-8'?> | ||
| <plugin id="cordova-plugin-progress" version="0.0.2" xmlns="http://apache.org/cordova/ns/plugins/1.0"> | ||
| <plugin id="cordova-plugin-progress" version="0.1.1" xmlns="http://apache.org/cordova/ns/plugins/1.0"> | ||
| <name>Progress</name> | ||
@@ -4,0 +4,0 @@ <author>Lee Crossley (http://ilee.co.uk/)</author> |
+90
-3
| ## Progress Plugin for Apache Cordova [](http://badge.fury.io/js/cordova-plugin-progress) | ||
| **Cordova / PhoneGap Plugin for Progress HUD Notifications via [KVNProgress](https://github.com/kevin-hirsch/KVNProgress)** | ||
| **Cordova / PhoneGap Plugin for Progress HUD Notifications via [KVNProgress](https://github.com/kevin-hirsch/KVNProgress).** | ||
| ## Demo | ||
| <img src="https://raw.github.com/leecrossley/cordova-plugin-progress/master/progress.gif" alt="Cordova Progress" width="180"> | ||
| ## Install | ||
@@ -21,7 +25,90 @@ | ||
| **More documentation to follow, plugin is still a WIP and not ready for production use** | ||
| ## Usage | ||
| ### show | ||
| Show the basic indeterminate progress loader. | ||
| ```js | ||
| // with success and error handlers | ||
| progress.show(successHandler, errorHandler); | ||
| // without callback functions | ||
| progress.show(); | ||
| ``` | ||
| Show the basic indeterminate progress loader, with text. When text is supplied, the loader width is larger. | ||
| ```js | ||
| // with success and error handlers | ||
| progress.show(successHandler, errorHandler, {"text": "Loading..."}); | ||
| // with success and error handlers (shorthand) | ||
| progress.show(successHandler, errorHandler, "Loading..."); | ||
| // without callback functions | ||
| progress.show({"text": "Loading..."}); | ||
| // without callback functions (shorthand) | ||
| progress.show("Loading..."); | ||
| ``` | ||
| ### update | ||
| Update the loader text on the fly (animated). If the loader was initiated without text, the width will remain smaller than if it was initiated with text. | ||
| ```js | ||
| // with success and error handlers | ||
| progress.update(successHandler, errorHandler, {"text": "Still loading..."}); | ||
| // with success and error handlers (shorthand) | ||
| progress.update(successHandler, errorHandler, "Still loading..."); | ||
| // without callback functions | ||
| progress.update({"text": "Still loading..."}); | ||
| // without callback functions (shorthand) | ||
| progress.update("Still loading..."); | ||
| ``` | ||
| You can also use the update function to remove any previous text (an empty string is treated the same as omitting the string). | ||
| ```js | ||
| // with success and error handlers | ||
| progress.update(successHandler, errorHandler); | ||
| // without callback functions | ||
| progress.update(); | ||
| ``` | ||
| ### hide | ||
| Hide the loader. Note that the `successHandler` is called after the loader has completely disappeared. | ||
| ```js | ||
| // with success and error handlers | ||
| progress.hide(successHandler, errorHandler); | ||
| // without callback functions | ||
| progress.hide(); | ||
| ``` | ||
| ## Full basic example | ||
| ```js | ||
| // after the cordova device ready event has fired | ||
| progress.show("Loading..."); | ||
| setTimeout(function () { | ||
| progress.update("Still loading..."); | ||
| }, 1500); | ||
| setTimeout(function () { | ||
| progress.hide(); | ||
| }, 3000); | ||
| ``` | ||
| ## Platforms | ||
| iOS only. | ||
| iOS (7+) only. | ||
@@ -28,0 +115,0 @@ ## License |
+2
-11
@@ -16,12 +16,4 @@ // | ||
| NSMutableDictionary *args = [command.arguments objectAtIndex:0]; | ||
| NSString *text = [args objectForKey:@"text"]; | ||
| if (text != nil) | ||
| { | ||
| [KVNProgress showWithStatus:text]; | ||
| } | ||
| else | ||
| { | ||
| [KVNProgress show]; | ||
| } | ||
| [KVNProgress showWithStatus:[args objectForKey:@"text"]]; | ||
@@ -34,5 +26,4 @@ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId]; | ||
| NSMutableDictionary *args = [command.arguments objectAtIndex:0]; | ||
| NSString *text = [args objectForKey:@"text"]; | ||
| [KVNProgress updateStatus:text]; | ||
| [KVNProgress updateStatus:[args objectForKey:@"text"]]; | ||
@@ -39,0 +30,0 @@ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId]; |
+20
-0
@@ -9,2 +9,12 @@ | ||
| Progress.prototype.show = function (onSuccess, onError, options) { | ||
| if (arguments.length === 1 && typeof (arguments[0]) !== "function") { | ||
| options = arguments[0]; | ||
| arguments[0] = null; | ||
| } | ||
| if (typeof (options) === "string") { | ||
| options = {"text": options}; | ||
| } | ||
| if (typeof (options) === "undefined") { | ||
| options = {"text": ""}; | ||
| } | ||
| exec(onSuccess, onError, "Progress", "show", [options]); | ||
@@ -14,2 +24,12 @@ }; | ||
| Progress.prototype.update = function (onSuccess, onError, options) { | ||
| if (arguments.length === 1 && typeof (arguments[0]) !== "function") { | ||
| options = arguments[0]; | ||
| arguments[0] = null; | ||
| } | ||
| if (typeof (options) === "string") { | ||
| options = {"text": options}; | ||
| } | ||
| if (typeof (options) === "undefined") { | ||
| options = {"text": ""}; | ||
| } | ||
| exec(onSuccess, onError, "Progress", "update", [options]); | ||
@@ -16,0 +36,0 @@ }; |
3857879
179.04%15
7.14%34
142.86%119
271.88%