aquro-plugin-spinner
v1.0.4
Published
A Cordova plugin to prevent user interaction using an animated spinner overlay during a blocking operation.
Downloads
2
Maintainers
Readme
Spinner Cordova Plugin
This is a Cordova plugin for preventing user interaction using an animated spinner overlay during a blocking operation.
On Android the native ProgressDialog
is used, while on iOS it uses the MBProgressHud
library.
Install
To add the plugin to your Cordova project, simply add the plugin from the npm registry:
cordova plugin add cordova-plugin-spinner
Alternatively, you can install the latest version of the plugin directly from git:
cordova plugin add https://github.com/Justin-Credible/cordova-plugin-spinner
Usage
The plugin is available via a global variable named SpinnerPlugin
. It exposes the following properties and functions.
All functions accept optional success and failure callbacks as their final two arguments, where the failure callback will receive an error string as an argument unless otherwise noted.
A TypeScript definition file for the JavaScript interface is available in the typings
directory as well as on DefinitelyTyped via the tsd
tool.
Indeterminate Spinner
Show Spinner
Blocks user input using an indeterminate spinner.
Method Signature:
activityStart(labelText, options, successCallback, failureCallback)
Parameters:
labelText
(string): The (optional) attribute text to use for the spinner label.options
(object): The (optional) options object used to customize behavior.dimBackground
(boolean): True to use a dimmed background which overlays all content. (defaults to true)
Example Usage:
var options = { dimBackground: true };
SpinnerPlugin.activityStart("Loading...", options);
Hide Spinner
Allows user input by hiding the indeterminate spinner.
Method Signature:
activityStop(successCallback, failureCallback)
Example Usage:
SpinnerPlugin.activityStop();