This commit is contained in:
Max Lynch
2015-09-28 14:13:45 -05:00
parent cfc3758a3f
commit 659fa494ce

View File

@@ -5,6 +5,15 @@ import {NativePlugin} from '../plugin';
/**
* Simple loading popup indicators.
*
* Uses the `cordova-plugin-progressindicator` Cordova plugin. See the [plugin docs](http://paolobernasconi.com/cordova-progressIndicator/)
* for more information.
*
* @usage
*
* ```js
* Loading.show(true, 'Waiting...') // Dim the background and show label
* ```
*/
@NativePlugin({
name: 'Loading',
@@ -17,6 +26,14 @@ import {NativePlugin} from '../plugin';
}
})
export class Loading {
/**
* Show a simple loading box.
*
* @param dim {Boolean} whether the dim the background
* @param label {String} the custom label
* @param detail {String} any detail text
*/
static simple(dim, label, detail) {
this.ifPlugin(() => {
if(typeof label === 'undefined') {
@@ -33,6 +50,14 @@ export class Loading {
})
}
/**
* Show a deteriminate loading box with progress bar
* that completes after a certain amount of time
*
* @param dim {Boolean} whether the dim the background
* @param timeout {Integer} the timeout for the loading box
* @param label {String} the custom label
*/
static determinate(dim, timeout, label) {
this.ifPlugin(() => {
if(typeof label === 'undefined') {
@@ -47,6 +72,13 @@ export class Loading {
})
}
/**
* Show a spinning circle
*
* @param dim {Boolean} whether the dim the background
* @param timeout {Integer} the timeout for the loading box
* @param label {String} the custom label
*/
static annular(dim, timeout, label) {
this.ifPlugin(() => {
if(typeof label === 'undefined') {
@@ -61,6 +93,13 @@ export class Loading {
})
}
/**
* Show a bar
*
* @param dim {Boolean} whether the dim the background
* @param timeout {Integer} the timeout for the loading box
* @param label {String} the custom label
*/
static bar(dim, timeout, label) {
this.ifPlugin(() => {
if(typeof label === 'undefined') {
@@ -75,12 +114,21 @@ export class Loading {
})
}
/**
* Show a success checkmark
*
* @param dim {Boolean} whether the dim the background
* @param label {String} the custom label
*/
static success(dim, label) {
this.ifPlugin(() => {
window.ProgressIndicator.showSuccess(dim, label);
})
}
/**
* Hide a loading box
*/
static hide() {
this.ifPlugin(() => {
window.ProgressIndicator.hide();