mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2025-02-24 02:02:51 +08:00
41 lines
1.3 KiB
JavaScript
Executable File
41 lines
1.3 KiB
JavaScript
Executable File
function Toast() {
|
|
}
|
|
|
|
Toast.prototype.show = function (message, duration, position, successCallback, errorCallback) {
|
|
cordova.exec(successCallback, errorCallback, "Toast", "show", [message, duration, position]);
|
|
};
|
|
|
|
Toast.prototype.showShortTop = function (message, successCallback, errorCallback) {
|
|
this.show(message, "short", "top", successCallback, errorCallback);
|
|
};
|
|
|
|
Toast.prototype.showShortCenter = function (message, successCallback, errorCallback) {
|
|
this.show(message, "short", "center", successCallback, errorCallback);
|
|
};
|
|
|
|
Toast.prototype.showShortBottom = function (message, successCallback, errorCallback) {
|
|
this.show(message, "short", "bottom", successCallback, errorCallback);
|
|
};
|
|
|
|
Toast.prototype.showLongTop = function (message, successCallback, errorCallback) {
|
|
this.show(message, "long", "top", successCallback, errorCallback);
|
|
};
|
|
|
|
Toast.prototype.showLongCenter = function (message, successCallback, errorCallback) {
|
|
this.show(message, "long", "center", successCallback, errorCallback);
|
|
};
|
|
|
|
Toast.prototype.showLongBottom = function (message, successCallback, errorCallback) {
|
|
this.show(message, "long", "bottom", successCallback, errorCallback);
|
|
};
|
|
|
|
Toast.install = function () {
|
|
if (!window.plugins) {
|
|
window.plugins = {};
|
|
}
|
|
|
|
window.plugins.toast = new Toast();
|
|
return window.plugins.toast;
|
|
};
|
|
|
|
cordova.addConstructor(Toast.install); |