Support for multiple return values (Android does not support that feature out of the box)

This commit is contained in:
Sebastián Katzer 2013-08-21 18:04:51 +02:00
parent 86daaca96e
commit ee22382510

View File

@ -22,7 +22,9 @@ Printer.prototype = {
*/ */
isServiceAvailable: function (callback, scope) { isServiceAvailable: function (callback, scope) {
var callbackFn = function () { var callbackFn = function () {
callback.apply(scope || window, arguments); var args = typeof arguments[0] == 'boolean' ? arguments : arguments[0];
callback.apply(scope || window, args);
}; };
cordova.exec(callbackFn, null, 'Printer', 'isServiceAvailable', []); cordova.exec(callbackFn, null, 'Printer', 'isServiceAvailable', []);
@ -46,7 +48,9 @@ Printer.prototype = {
if (typeof callback == 'function'){ if (typeof callback == 'function'){
callbackFn = function () { callbackFn = function () {
callback.apply(scope || window, arguments); var args = typeof arguments[0] == 'boolean' ? arguments : arguments[0];
callback.apply(scope || window, args);
} }
} }