mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-12 18:56:31 +08:00
71 lines
3.4 KiB
TypeScript
71 lines
3.4 KiB
TypeScript
import { Observable } from 'rxjs/Observable';
|
|
export interface ToastOptions {
|
|
message?: string;
|
|
duration?: string;
|
|
position?: string;
|
|
addPixelsY?: number;
|
|
}
|
|
/**
|
|
* This plugin allows you to show a native Toast (a little text popup) on iOS, Android and WP8. It's great for showing a non intrusive native notification which is guaranteed always in the viewport of the browser.
|
|
*
|
|
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
|
|
*/
|
|
export declare class Toast {
|
|
/**
|
|
* Show a native toast for the given duration at the specified position.
|
|
*
|
|
* @param {string} message The message to display.
|
|
* @param {string} duration Duration to show the toast, either 'short' or 'long'.
|
|
* @param {string} position Where to position the toast, either 'top', 'center', or 'bottom'.
|
|
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
|
*/
|
|
static show(message: string, duration: string, position: string): Observable<any>;
|
|
/**
|
|
* Manually hide any currently visible toast.
|
|
* @return {Promise} Returns a Promise that resolves on success.
|
|
*/
|
|
static hide(): Promise<any>;
|
|
/**
|
|
* Show a native toast with the given options.
|
|
*
|
|
* @param {Object} options Options for showing a toast. Available options:
|
|
* message The message to display.
|
|
* duration Duration to show the toast, either 'short' or 'long'.
|
|
* position Where to position the toast, either 'top', 'center', or 'bottom'.
|
|
* addPixelsY Offset in pixels to move the toast up or down from its specified position.
|
|
*
|
|
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
|
*/
|
|
static showWithOptions(options: ToastOptions): Observable<any>;
|
|
/**
|
|
* Shorthand for `show(message, 'short', 'top')`.
|
|
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
|
*/
|
|
static showShortTop(message: string): Observable<any>;
|
|
/**
|
|
* Shorthand for `show(message, 'short', 'center')`.
|
|
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
|
*/
|
|
static showShortCenter(message: string): Observable<any>;
|
|
/**
|
|
* Shorthand for `show(message, 'short', 'bottom')`.
|
|
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
|
*/
|
|
static showShortBottom(message: string): Observable<any>;
|
|
/**
|
|
* Shorthand for `show(message, 'long', 'top')`.
|
|
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
|
*/
|
|
static showLongTop(message: string): Observable<any>;
|
|
/**
|
|
* Shorthand for `show(message, 'long', 'center')`.
|
|
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
|
*/
|
|
static showLongCenter(message: string): Observable<any>;
|
|
/**
|
|
* Shorthand for `show(message, 'long', 'bottom')`.
|
|
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
|
*/
|
|
static showLongBottom(message: string): Observable<any>;
|
|
}
|