blob: 66cae0ef6e5198a5896bcdc5310b7e7150a91a17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { waitFor } from "../webpack";
let NoticesModule: any;
waitFor(m => m.show && m.dismiss && !m.suppressAll, m => NoticesModule = m);
export const noticesQueue = [] as any[];
export let currentNotice: any = null;
export function popNotice() {
NoticesModule.dismiss();
}
export function nextNotice() {
currentNotice = noticesQueue.shift();
if (currentNotice) {
NoticesModule.show(...currentNotice, "VencordNotice");
}
}
export function showNotice(message: string, buttonText: string, onOkClick: () => void) {
noticesQueue.push(["GENERIC", message, buttonText, onOkClick]);
if (!currentNotice) nextNotice();
}
|