Last active
August 29, 2015 14:08
-
-
Save maxkatz/8410f5ba72627e2aca56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cordova.define("nl.xservices.plugins.Toast", function(require, exports, module) { | |
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); | |
var toast = new Toast(); | |
module.exports = toast; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment