diff --git a/dist/plugins/toast.d.ts b/dist/plugins/toast.d.ts index d8404f1e9..d8033e439 100644 --- a/dist/plugins/toast.d.ts +++ b/dist/plugins/toast.d.ts @@ -1,4 +1,70 @@ -export declare class Toast { - static hide(): void; - static showWithOptions(options: any): void; +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; + /** + * Manually hide any currently visible toast. + * @return {Promise} Returns a Promise that resolves on success. + */ + static hide(): Promise; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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; } diff --git a/dist/plugins/toast.js b/dist/plugins/toast.js index 47f91dd69..e7d13f58c 100644 --- a/dist/plugins/toast.js +++ b/dist/plugins/toast.js @@ -5,19 +5,185 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; var plugin_1 = require('./plugin'); +var Observable_1 = require('rxjs/Observable'); +/** + * 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). + */ var Toast = (function () { function Toast() { } - Toast.hide = function () { }; - ; - Toast.showWithOptions = function (options) { }; - ; + /** + * 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. + */ + Toast.show = function (message, duration, position) { + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable_1.Observable(function (observer) { }); + }; + /** + * Manually hide any currently visible toast. + * @return {Promise} Returns a Promise that resolves on success. + */ + Toast.hide = function () { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * 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. + */ + Toast.showWithOptions = function (options) { + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable_1.Observable(function (observer) { }); + }; + /** + * Shorthand for `show(message, 'short', 'top')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + Toast.showShortTop = function (message) { + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable_1.Observable(function (observer) { }); + }; + /** + * Shorthand for `show(message, 'short', 'center')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + Toast.showShortCenter = function (message) { + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable_1.Observable(function (observer) { }); + }; + /** + * Shorthand for `show(message, 'short', 'bottom')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + Toast.showShortBottom = function (message) { + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable_1.Observable(function (observer) { }); + }; + /** + * Shorthand for `show(message, 'long', 'top')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + Toast.showLongTop = function (message) { + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable_1.Observable(function (observer) { }); + }; + /** + * Shorthand for `show(message, 'long', 'center')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + Toast.showLongCenter = function (message) { + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable_1.Observable(function (observer) { }); + }; + /** + * Shorthand for `show(message, 'long', 'bottom')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + Toast.showLongBottom = function (message) { + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable_1.Observable(function (observer) { }); + }; + __decorate([ + plugin_1.Cordova({ + observable: true, + clearFunction: 'hide' + }) + ], Toast, "show", null); __decorate([ plugin_1.Cordova() ], Toast, "hide", null); __decorate([ - plugin_1.Cordova() + plugin_1.Cordova({ + observable: true, + clearFunction: 'hide' + }) ], Toast, "showWithOptions", null); + __decorate([ + plugin_1.Cordova({ + observable: true, + clearFunction: 'hide' + }) + ], Toast, "showShortTop", null); + __decorate([ + plugin_1.Cordova({ + observable: true, + clearFunction: 'hide' + }) + ], Toast, "showShortCenter", null); + __decorate([ + plugin_1.Cordova({ + observable: true, + clearFunction: 'hide' + }) + ], Toast, "showShortBottom", null); + __decorate([ + plugin_1.Cordova({ + observable: true, + clearFunction: 'hide' + }) + ], Toast, "showLongTop", null); + __decorate([ + plugin_1.Cordova({ + observable: true, + clearFunction: 'hide' + }) + ], Toast, "showLongCenter", null); + __decorate([ + plugin_1.Cordova({ + observable: true, + clearFunction: 'hide' + }) + ], Toast, "showLongBottom", null); Toast = __decorate([ plugin_1.Plugin({ name: 'Toast', diff --git a/dist/plugins/toast.js.map b/dist/plugins/toast.js.map index ab360832b..273cc12dd 100644 --- a/dist/plugins/toast.js.map +++ b/dist/plugins/toast.js.map @@ -1 +1 @@ -{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/plugins/toast.ts"],"names":["Toast","Toast.constructor","Toast.hide","Toast.showWithOptions"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAYAC,CAACA;IAJQD,UAAIA,GADXA,cACcE,CAACA;;IAGRF,qBAAeA,GADtBA,UACuBA,OAAWA,IAAEG,CAACA;;IAJrCH;QAACA,gBAAOA,EAAEA;OACHA,aAAIA,QAAIA;IAEfA;QAACA,gBAAOA,EAAEA;OACHA,wBAAeA,QAAeA;IAXvCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,OAAOA;YACbA,MAAMA,EAAEA,wBAAwBA;YAChCA,SAASA,EAAEA,eAAeA;YAC1BA,IAAIA,EAAEA,yDAAyDA;SAChEA,CAACA;cAODA;IAADA,YAACA;AAADA,CAACA,AAZD,IAYC;AANY,aAAK,QAMjB,CAAA"} \ No newline at end of file +{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/plugins/toast.ts"],"names":["Toast","Toast.constructor","Toast.show","Toast.hide","Toast.showWithOptions","Toast.showShortTop","Toast.showShortCenter","Toast.showShortBottom","Toast.showLongTop","Toast.showLongCenter","Toast.showLongBottom"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AACzC,2BAAyB,iBAAiB,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A;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,wBAAeA,QAOrBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,qBAAYA,QAOlBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,wBAAeA,QAOrBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,wBAAeA,QAOrBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,oBAAWA,QAOjBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,uBAAcA,QAOpBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,uBAAcA,QAOpBA;IAvKHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,OAAOA;YACbA,MAAMA,EAAEA,wBAAwBA;YAChCA,SAASA,EAAEA,eAAeA;YAC1BA,IAAIA,EAAEA,yDAAyDA;SAChEA,CAACA;cAmKDA;IAADA,YAACA;AAADA,CAACA,AAxKD,IAwKC;AAlKY,aAAK,QAkKjB,CAAA"} \ No newline at end of file diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 8097b8406..cc35d5143 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -1,5 +1,17 @@ import {Plugin, Cordova} from './plugin'; +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). + */ @Plugin({ name: 'Toast', plugin: 'cordova-plugin-x-toast', @@ -7,9 +19,165 @@ import {Plugin, Cordova} from './plugin'; repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin' }) export class Toast { - @Cordova() - static hide(){}; + /** + * 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. + */ + @Cordova({ + observable: true, + clearFunction: 'hide' + }) + static show(message: string, duration: string, position: string){ + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable(observer => {}); + } + + /** + * Manually hide any currently visible toast. + * @return {Promise} Returns a Promise that resolves on success. + */ @Cordova() - static showWithOptions(options:any){}; + static hide(){ + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + + /** + * 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. + */ + @Cordova({ + observable: true, + clearFunction: 'hide' + }) + static showWithOptions(options: ToastOptions){ + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable(observer => {}); + } + + /** + * Shorthand for `show(message, 'short', 'top')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + @Cordova({ + observable: true, + clearFunction: 'hide' + }) + static showShortTop(message: string){ + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable(observer => {}); + } + + /** + * Shorthand for `show(message, 'short', 'center')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + @Cordova({ + observable: true, + clearFunction: 'hide' + }) + static showShortCenter(message: string){ + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable(observer => {}); + } + + /** + * Shorthand for `show(message, 'short', 'bottom')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + @Cordova({ + observable: true, + clearFunction: 'hide' + }) + static showShortBottom(message: string){ + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable(observer => {}); + } + + /** + * Shorthand for `show(message, 'long', 'top')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + @Cordova({ + observable: true, + clearFunction: 'hide' + }) + static showLongTop(message: string){ + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable(observer => {}); + } + + /** + * Shorthand for `show(message, 'long', 'center')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + @Cordova({ + observable: true, + clearFunction: 'hide' + }) + static showLongCenter(message: string){ + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable(observer => {}); + } + + /** + * Shorthand for `show(message, 'long', 'bottom')`. + * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + */ + @Cordova({ + observable: true, + clearFunction: 'hide' + }) + static showLongBottom(message: string){ + // This Observable is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Observable, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Observable(observer => {}); + } }