Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
abdmmar committed Dec 27, 2021
1 parent 3b48a37 commit bda2976
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit bda2976

Please sign in to comment.