diff options
Diffstat (limited to 'src/js/Services/ToastService.js')
-rw-r--r-- | src/js/Services/ToastService.js | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/js/Services/ToastService.js b/src/js/Services/ToastService.js index bb2bacc..088722b 100644 --- a/src/js/Services/ToastService.js +++ b/src/js/Services/ToastService.js @@ -40,15 +40,26 @@ class ToastService { } } + /** + * + * @param {(String|String[])} message The text of the toast + * @param {(String|String[])} [title=null] The title of the toast + * @param {Number} [ttl=3] Time before the toast is closed + * @return {Promise<String>} + */ + success(message, title = null, ttl = 3) { + return this.create({type: 'success', title, message, closeable: true, ttl}); + } /** * * @param {(String|String[])} message The text of the toast * @param {(String|String[])} [title=null] The title of the toast + * @param {Number} [ttl=10] Time before the toast is closed * @return {Promise<String>} */ - warning(message, title = null) { - return this.create({type: 'warning', title, message, closeable: true, ttl: 10}); + warning(message, title = null, ttl = 10) { + return this.create({type: 'warning', title, message, closeable: true, ttl}); } @@ -56,10 +67,11 @@ class ToastService { * * @param {(String|String[])} message The text of the toast * @param {(String|String[])} [title=null] The title of the toast + * @param {Number} [ttl=10] Time before the toast is closed * @return {Promise<String>} */ - error(message, title = null) { - return this.create({type: 'error', title, message, closeable: true, ttl: 10}); + error(message, title = null, ttl = 10) { + return this.create({type: 'error', title, message, closeable: true, ttl}); } /** @@ -80,16 +92,6 @@ class ToastService { return this.create(config); } - /** - * - * @param {(String|String[])} message The text of the toast - * @param {(String|String[])} [title=null] The title of the toast - * @return {Promise<String>} - */ - success(message, title = null) { - return this.create({type: 'success', title, message, closeable: true, ttl: 3}); - } - /** * |