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
+21
View File
@@ -0,0 +1,21 @@
import {Plugin, Cordova} from './plugin';
@Plugin({
name: 'ActionSheet',
plugin: 'cordova-plugin-actionsheet',
pluginRef: 'plugins.actionsheet',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet'
})
export class ActionSheet {
@Cordova({
successIndex: 1,
errIndex: 2
})
static show;
@Cordova({
successIndex: 1,
errIndex: 2
})
static hide;
}
-2
View File
@@ -1,7 +1,5 @@
import {Plugin, Cordova} from './plugin';
let PLUGIN_REF = 'navigator.camera';
@Plugin({
name: 'Camera',
plugin: 'cordova-plugin-camera',
+7 -1
View File
@@ -5,9 +5,15 @@ declare var Promise;
export const wrap = function(pluginObj, methodName, opts: any = {}) {
return (...args) => {
console.log('Trying', pluginObj.name, methodName, args);
return new Promise((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;
}
+2 -1
View File
@@ -3,7 +3,8 @@ import {Plugin, Cordova} from './plugin';
@Plugin({
name: 'Toast',
plugin: 'cordova-plugin-x-toast',
pluginRef: 'plugins.toast'
pluginRef: 'plugins.toast',
repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin'
})
export class Toast {
@Cordova({