npm.io
0.0.3 • Published 3 years ago

cordova-plugin-rnk-toast

Licence
ISC
Version
0.0.3
Deps
0
Size
5 kB
Vulns
0
Weekly
0

ToastPlugin

Android Toast for cordova

Install

cordova plugin add cordova-plugin-rnk-toast

Uninstall

cordova plugin rm cordova-plugin-rnk-toast

Usage

cordova.plugins.rnk.toast.showToast(String msg, number duration, success, error)

Example

// plugin will be availbale on deviceready event

var Toast;
document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
    console.log(cordova.plugins.rnk.toast);
    Toast = cordova.plugins.rnk.toast;
}

// show a simple toast
function showShortToast(){
    Toast.showToast("My short toast");
}

// show a long toast
function showLongToast(){
    Toast.showToast("My long toast", Toast.LONG) 
}


Callback


// callback after toast triggered
function showToastWithCallback(){
    Toast.showToast("My long toast", 0, success, error) 
}

function success(res){
    console.log(res)
}
function error(err){
    console.log(err)
}

Set Toast Duration

Toast.SHORT = 0 // number default
Toast.LONG = 1  // number

Plugin

Platform Toast
android
ios

Keywords