1 | import { IonicNativePlugin } from '@ionic-native/core';
|
2 | import { Observable } from 'rxjs';
|
3 | export interface ToastOptions {
|
4 | /**
|
5 | * Message to display
|
6 | */
|
7 | message?: string;
|
8 | /**
|
9 | * Duration in ms to show
|
10 | */
|
11 | duration?: number;
|
12 | /**
|
13 | * Position
|
14 | */
|
15 | position?: string;
|
16 | /**
|
17 | * Add negative value to move it up a bit
|
18 | */
|
19 | addPixelsY?: number;
|
20 | /**
|
21 | * Pass JSON object to be sent back in success callback
|
22 | */
|
23 | data?: any;
|
24 | /**
|
25 | * Styling
|
26 | */
|
27 | styling?: {
|
28 | opacity?: number;
|
29 | backgroundColor?: string;
|
30 | textColor?: string;
|
31 | cornerRadius?: number;
|
32 | horizontalPadding?: number;
|
33 | verticalPadding?: number;
|
34 | };
|
35 | }
|
36 | /**
|
37 | * @name Toast
|
38 | * @description
|
39 | * 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.
|
40 | *
|
41 | * Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
|
42 | *
|
43 | * @usage
|
44 | * ```typescript
|
45 | * import { Toast } from '@ionic-native/toast/ngx';
|
46 | *
|
47 | * constructor(private toast: Toast) { }
|
48 | *
|
49 | * ...
|
50 | *
|
51 | * this.toast.show(`I'm a toast`, '5000', 'center').subscribe(
|
52 | * toast => {
|
53 | * console.log(toast);
|
54 | * }
|
55 | * );
|
56 | * ```
|
57 | * @interfaces
|
58 | * ToastOptions
|
59 | */
|
60 | export declare class ToastOriginal extends IonicNativePlugin {
|
61 | /**
|
62 | * Show a native toast for the given duration at the specified position.
|
63 | *
|
64 | * @param {string} message The message to display.
|
65 | * @param {string} duration Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'.
|
66 | * @param {string} position Where to position the toast, either 'top', 'center', or 'bottom'.
|
67 | * @returns {Observable<any>} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
68 | */
|
69 | show(message: string, duration: string, position: string): Observable<any>;
|
70 | /**
|
71 | * Manually hide any currently visible toast.
|
72 | * @returns {Promise<any>} Returns a Promise that resolves on success.
|
73 | */
|
74 | hide(): Promise<any>;
|
75 | /**
|
76 | * Show a native toast with the given options.
|
77 | *
|
78 | * @param {Object} options Options for showing a toast. Available options:
|
79 | * message The message to display.
|
80 | * duration Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'.
|
81 | * position Where to position the toast, either 'top', 'center', or 'bottom'.
|
82 | * addPixelsY Offset in pixels to move the toast up or down from its specified position.
|
83 | *
|
84 | * @returns {Observable<any>} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
85 | */
|
86 | showWithOptions(options: ToastOptions): Observable<any>;
|
87 | /**
|
88 | * Shorthand for `show(message, 'short', 'top')`.
|
89 | * @param message {string}
|
90 | * @returns {Observable<any>} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
91 | */
|
92 | showShortTop(message: string): Observable<any>;
|
93 | /**
|
94 | * Shorthand for `show(message, 'short', 'center')`.
|
95 | * @param message {string}
|
96 | * @returns {Observable<any>} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
97 | */
|
98 | showShortCenter(message: string): Observable<any>;
|
99 | /**
|
100 | * Shorthand for `show(message, 'short', 'bottom')`.
|
101 | * @param message {string}
|
102 | * @returns {Observable<any>} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
103 | */
|
104 | showShortBottom(message: string): Observable<any>;
|
105 | /**
|
106 | * Shorthand for `show(message, 'long', 'top')`.
|
107 | * @param message {string}
|
108 | * @returns {Observable<any>} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
109 | */
|
110 | showLongTop(message: string): Observable<any>;
|
111 | /**
|
112 | * Shorthand for `show(message, 'long', 'center')`.
|
113 | * @param message {string}
|
114 | * @returns {Observable<any>} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
115 | */
|
116 | showLongCenter(message: string): Observable<any>;
|
117 | /**
|
118 | * Shorthand for `show(message, 'long', 'bottom')`.
|
119 | * @param message {string}
|
120 | * @returns {Observable<any>} Returns an Observable that notifies first on success and then when tapped, rejects on error.
|
121 | */
|
122 | showLongBottom(message: string): Observable<any>;
|
123 | }
|
124 |
|
125 | export declare const Toast: ToastOriginal; |
\ | No newline at end of file |