mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-02 00:07:23 +08:00
new wrap
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import {Page, NavController} from 'ionic/ionic'
|
||||
|
||||
import {ActionSheet, Camera, StatusBar, Toast} from 'ionic-native';
|
||||
import {
|
||||
ActionSheet,
|
||||
Camera,
|
||||
Device,
|
||||
StatusBar,
|
||||
Toast
|
||||
} from 'ionic-native';
|
||||
|
||||
import {Plugin} from '../plugin/plugin';
|
||||
|
||||
@@ -14,6 +20,7 @@ export class HomePage {
|
||||
this.plugins = [
|
||||
ActionSheet,
|
||||
Camera,
|
||||
Device,
|
||||
StatusBar,
|
||||
Toast
|
||||
];
|
||||
|
||||
@@ -59,12 +59,18 @@ export class Plugin {
|
||||
addPixelsY: -40 // added a negative value to move it up a bit (default 0)
|
||||
});
|
||||
console.log('Doing method', method, 'on Plugin', this.plugin, 'args:', args);
|
||||
// TODO: Pass args
|
||||
this.plugin[method].apply(this.plugin, args).then(() => {
|
||||
console.log('Success', arguments);
|
||||
}, (err) => {
|
||||
console.error('Error', err);
|
||||
});
|
||||
|
||||
let v = this.plugin[method].apply(this.plugin, args);
|
||||
|
||||
if(v && v.then) {
|
||||
v.then(() => {
|
||||
console.log('Success', arguments);
|
||||
}, (err) => {
|
||||
console.error('Error', err);
|
||||
});
|
||||
} else {
|
||||
console.log('Response: ', v);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user