File size: 772 Bytes
01fcadf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
type ToastType = "success" | "error" | "multiline";
type Position =
    | "top-left"
    | "top-middle"
    | "top-right"
    | "bottom-left"
    | "bottom-right"
    | "bottom-center";
interface Props {
    toastType: ToastType;
    text: string;
    class: string;
    id?: string;
    duration?: number;
    emoji?: any;
    position?: Position;
}

function toast(query: string) {
    const wrapper = document.getElementById("toastwrapper") as HTMLDivElement;
    wrapper.classList.remove("hidden");
    //this is a really hacky solution for toast notifications LOL
    const element = document.querySelector(query) as HTMLElement;
    //click the element
    element.click();
}

export { type ToastType, type Position, type Props, toast };