in src/components/base/toast/toast.js [45:76]
function showToast(message, options = {}) {
// eslint-disable-next-line @gitlab/tailwind-no-interpolation -- Not a CSS utility
const id = `gl-toast-${toastsCount}`;
toastsCount += 1;
const hide = () => {
this.$bvToast.hide(id);
};
const toast = { id, hide };
if (isFunction(options.onComplete)) {
const toastHiddenCallback = (e) => {
if (e.componentId === id) {
this.$root.$off('bv::toast:hidden', toastHiddenCallback);
options.onComplete(e);
}
};
this.$root.$on('bv::toast:hidden', toastHiddenCallback);
}
const updatedAutoHideDelay = !Number.isNaN(options?.autoHideDelay)
? { autoHideDelay: options.autoHideDelay }
: null;
this.$bvToast.toast(message, {
...DEFAULT_OPTIONS,
...updatedAutoHideDelay,
id,
title: renderTitle(this.$createElement, toast, options),
});
return toast;
}