diff options
author | Vendicated <vendicated@riseup.net> | 2022-08-29 22:05:22 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-08-29 22:05:22 +0200 |
commit | 483bc13a31ab2ba878ff8d9002b0a8671a640ec8 (patch) | |
tree | 9967493cf8d65dc90202bb76d604749c5c4ba5ca /src/api | |
parent | c39ff8f6481463a1700014ebd204f2b6189759a1 (diff) | |
download | Vencord-483bc13a31ab2ba878ff8d9002b0a8671a640ec8.tar.gz Vencord-483bc13a31ab2ba878ff8d9002b0a8671a640ec8.tar.bz2 Vencord-483bc13a31ab2ba878ff8d9002b0a8671a640ec8.zip |
Finish rewrite
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/MessageClicks.ts | 17 | ||||
-rw-r--r-- | src/api/index.ts | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/api/MessageClicks.ts b/src/api/MessageClicks.ts new file mode 100644 index 0000000..476896d --- /dev/null +++ b/src/api/MessageClicks.ts @@ -0,0 +1,17 @@ +type Listener = (message, channel, event) => void; + +const listeners = new Set<Listener>(); + +export function _handleClick(message, channel, event) { + for (const listener of listeners) { + listener(message, channel, event); + } +} + +export function addListener(listener: Listener) { + listeners.add(listener); +} + +export function removeListener(listener: Listener) { + return listeners.delete(listener); +}
\ No newline at end of file diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 0000000..6688927 --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1 @@ +export * as MessageClicks from "./MessageClicks";
\ No newline at end of file |