yea toast
This commit is contained in:
parent
4b519753d2
commit
044a824f29
@ -17,5 +17,11 @@
|
||||
"ionic-native": "^1.0.7"
|
||||
},
|
||||
"name": "demo",
|
||||
"description": "demo: An Ionic project"
|
||||
"description": "demo: An Ionic project",
|
||||
"cordovaPlugins": [
|
||||
"cordova-plugin-x-toast"
|
||||
],
|
||||
"cordovaPlatforms": [
|
||||
"ios"
|
||||
]
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
6
dist/plugins/toast.d.ts
vendored
Normal file
6
dist/plugins/toast.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare var Toast: {
|
||||
name: string;
|
||||
plugin: string;
|
||||
showWithOptions: (...args: any[]) => any;
|
||||
hide: (...args: any[]) => any;
|
||||
};
|
10
dist/plugins/toast.js
vendored
Normal file
10
dist/plugins/toast.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
var util_1 = require('../util');
|
||||
var PLUGIN_REF = 'plugins.toast';
|
||||
exports.Toast = {
|
||||
// Metadata
|
||||
name: 'Toast',
|
||||
plugin: 'cordova-plugin-x-toast',
|
||||
// Methods
|
||||
showWithOptions: util_1.wrap(PLUGIN_REF, 'showWithOptions', 1, 2),
|
||||
hide: util_1.promisify(PLUGIN_REF, 'hide', 0, 1),
|
||||
};
|
6
dist/src/plugins/toast.d.ts
vendored
Normal file
6
dist/src/plugins/toast.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare var Toast: {
|
||||
name: string;
|
||||
plugin: string;
|
||||
showWithOptions: (...args: any[]) => any;
|
||||
hide: (...args: any[]) => any;
|
||||
};
|
8
dist/src/plugins/toast.js
vendored
Normal file
8
dist/src/plugins/toast.js
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
var util_1 = require('../util');
|
||||
var PLUGIN_REF = 'plugins.toast';
|
||||
exports.Toast = {
|
||||
name: 'Toast',
|
||||
plugin: 'cordova-plugin-x-toast',
|
||||
showWithOptions: util_1.wrap(PLUGIN_REF, 'showWithOptions', 1, 2),
|
||||
hide: util_1.promisify(PLUGIN_REF, 'hide', 0, 1),
|
||||
};
|
13
src/plugins/toast.ts
Normal file
13
src/plugins/toast.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import {wrap, promisify} from '../util';
|
||||
|
||||
let PLUGIN_REF = 'plugins.toast'
|
||||
|
||||
export var Toast = {
|
||||
// Metadata
|
||||
name: 'Toast',
|
||||
plugin: 'cordova-plugin-x-toast',
|
||||
|
||||
// Methods
|
||||
showWithOptions: wrap(PLUGIN_REF, 'showWithOptions', 1, 2),
|
||||
hide: promisify(PLUGIN_REF, 'hide', 0, 1),
|
||||
}
|
Loading…
Reference in New Issue
Block a user