mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-02 00:07:23 +08:00
Device ready call
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
let PLUGIN_REF = 'navigator.camera';
|
||||
|
||||
@Plugin({
|
||||
name: 'Camera',
|
||||
plugin: 'cordova-plugin-camera',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user