Device ready call

This commit is contained in:
Max Lynch
2015-11-29 16:30:15 -06:00
parent 3327fe8f45
commit 45dc983752
23 changed files with 150 additions and 14 deletions
+6 -1
View File
@@ -6,8 +6,13 @@ exports.wrap = function (pluginObj, methodName, opts) {
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
console.log('Trying', pluginObj.name, methodName, args);
return new Promise(function (resolve, reject) {
if (!window.cordova) {
console.warn('Native: tried calling ' + pluginObj.name + '.' + methodName + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
reject({
error: 'cordova_not_available'
});
}
if (typeof opts.successIndex !== 'undefined') {
args[opts.successIndex] = resolve;
}