All Products
Search
Document Center

SuperApp:Prompt

Last Updated:Oct 25, 2024

This topic describes the JavaScript API of WVUIToast. You can refer to this topic when you create HTML5 apps or MiniApps. You can use the JavaScript API of WVUIToast to display a toast message.

WVUIToast.toast

Displays a toast message in the center of the screen.

Effect on iOS devices

Effect on Android devices

WVUIToast_toast_iOS@2x.png

WVUIToast_toast_Android@2x.png

Input parameters

  • [string]message: the toast message that you want to display.

  • [number]duration: optional. The duration for which the toast message is displayed. Unit: seconds. Default value: 0.8.

Callback parameters

No callback parameters exist. If the toast message is displayed, the success callback is invoked. Otherwise, the failure callback is invoked.

var params = {
        // The toast message that you want to display.
        message: 'Toast information',
        // The duration for which the toast message is displayed.
        duration: 5
};
window.WindVane.call('WVUIToast', 'toast', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});