forked from Paldom/SpinnerDialog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspinner.js
24 lines (20 loc) · 1.02 KB
/
spinner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var exec = require('cordova/exec');
module.exports = {
show: function (title, message, cancelCallback, iosOptions) {
if (cancelCallback == true && typeof cancelCallback !== "function") {
cancelCallback = function () { };
}
var isPlatformIos = (navigator.userAgent.match(/iPad/i)) == "iPad" || (navigator.userAgent.match(/iPhone/i)) == "iPhone" ? true : false;
var params = [title, message, !!cancelCallback];
if (isPlatformIos) {
if (typeof iosOptions != "object") {
iosOptions = { overlayOpacity: 0.35, textColorRed: 1, textColorGreen: 1, textColorBlue: 1 }
}
params = params.concat([(iosOptions.overlayOpacity || 0.35), (iosOptions.textColorRed || 1), (iosOptions.textColorGreen || 1), (iosOptions.textColorBlue || 1)])
}
cordova.exec(cancelCallback, null, 'SpinnerDialog', 'show', params);
},
hide: function (success, fail) {
cordova.exec(success, fail, 'SpinnerDialog', 'hide', ["", ""]);
}
};