1
0
Эх сурвалжийг харах

feat: ability to use duration=Infinity in showToast

Sv443 9 сар өмнө
parent
commit
27a5cdb3fd

+ 3 - 2
src/components/toast.ts

@@ -105,9 +105,10 @@ export async function showToast({
 
   await pauseFor(100);
 
-  toastElem.classList.add("visible", `pos-${position}`);
+  toastElem.classList.add("visible", `pos-${position.toLowerCase()}`);
 
-  timeout = setTimeout(async () => await closeToast(), duration * 1000);
+  if(duration < Number.POSITIVE_INFINITY)
+    timeout = setTimeout(async () => await closeToast(), duration * 1000);
 }
 
 /** Closes the currently open toast */