Skip to content

Latest commit

 

History

History
118 lines (77 loc) · 2.92 KB

README.md

File metadata and controls

118 lines (77 loc) · 2.92 KB

Progress Plugin for Apache Cordova npm version

Cordova / PhoneGap Plugin for Progress HUD Notifications via KVNProgress.

Demo

Cordova Progress

Install

Latest published version on npm (with Cordova CLI >= 5.0.0)

cordova plugin add cordova-plugin-progress

Latest version from GitHub

cordova plugin add https://github.com/leecrossley/cordova-plugin-progress.git

You do not need to reference any JavaScript, the Cordova plugin architecture will add a progress object to your root automatically when you build.

Usage

show

Show the basic indeterminate progress loader.

// 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.

// 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.

// 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).

// 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.

// with success and error handlers
progress.hide(successHandler, errorHandler);

// without callback functions
progress.hide();

Full basic example

// 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 (7+) only.

License

MIT License

KVNProgress