mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-04-13 00:00:10 +08:00
yea toast
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
import {Page, NavParams} from 'ionic/ionic';
|
||||
|
||||
import {Camera, StatusBar, Toast} from 'ionic-native';
|
||||
|
||||
// To specify arguments for any plugin calls
|
||||
var demoArgs = {};
|
||||
demoArgs[Toast] = {
|
||||
showWithOptions: [
|
||||
{
|
||||
message: "hey there",
|
||||
duration: "short",
|
||||
position: "bottom",
|
||||
addPixelsY: -40 // added a negative value to move it up a bit (default 0)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@Page({
|
||||
templateUrl: 'app/plugin/plugin.html',
|
||||
})
|
||||
@@ -18,10 +33,17 @@ export class Plugin {
|
||||
}
|
||||
|
||||
doMethod(method) {
|
||||
console.log('Doing method', method, 'on Plugin', this.plugin);
|
||||
|
||||
let pluginMethodArgEntry = demoArgs[this.plugin];
|
||||
|
||||
let args = [];
|
||||
if(pluginMethodArgEntry) {
|
||||
args = pluginMethodArgEntry[method] || [];
|
||||
}
|
||||
|
||||
console.log('Doing method', method, 'on Plugin', this.plugin, 'args:', args);
|
||||
// TODO: Pass args
|
||||
this.plugin[method].apply(this.plugin);
|
||||
this.plugin[method].apply(this.plugin, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user