From bda29764b4723094edf3479fb36ec0b3f613112e Mon Sep 17 00:00:00 2001 From: abdmmar Date: Tue, 28 Dec 2021 01:54:41 +0700 Subject: [PATCH] fix types --- src/toast.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/toast.js b/src/toast.js index 0eab9ba..4248f27 100644 --- a/src/toast.js +++ b/src/toast.js @@ -9,7 +9,16 @@ const generateId = (function () { }; })(); -function createToast(message, type = 'blank', options) { +function createToast( + message, + type = 'blank', + options = { + icon: { type: '', content: '' }, + duration: '', + closeable: false, + theme: { type: 'light', style: { background: '', color: '', stroke: '' } } + } +) { const id = generateId(); const toastItem = createToastItem(id, type, options); const toastIcon = createToastIcon(type, options); @@ -156,7 +165,11 @@ toast.dismiss = function (toastId) { * @param {ToastOptions} [options] * @returns {Promise} */ -toast.promise = async function (promise, message, options) { +toast.promise = async function ( + promise, + message = { loading: '', success: '', error: '' }, + options +) { const id = toast.loading(message.loading, { ...options }); try {