mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-13 08:33:01 -04:00
Add in client updater, Notices API
This commit is contained in:
parent
9aaa47ea4e
commit
8161a07dba
20 changed files with 525 additions and 48 deletions
24
src/api/Notices.ts
Normal file
24
src/api/Notices.ts
Normal file
|
@ -0,0 +1,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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue