Fix Context Menu API (#583)
This commit is contained in:
parent
1b199ec5d8
commit
0fb3901a18
1 changed files with 3 additions and 1 deletions
|
@ -22,6 +22,8 @@ import definePlugin from "@utils/types";
|
||||||
import { addListener, removeListener } from "@webpack";
|
import { addListener, removeListener } from "@webpack";
|
||||||
|
|
||||||
function listener(exports: any, id: number) {
|
function listener(exports: any, id: number) {
|
||||||
|
if (!Settings.plugins.ContextMenuAPI.enabled) return removeListener(listener);
|
||||||
|
|
||||||
if (typeof exports !== "object" || exports === null) return;
|
if (typeof exports !== "object" || exports === null) return;
|
||||||
|
|
||||||
for (const key in exports) if (key.length <= 3) {
|
for (const key in exports) if (key.length <= 3) {
|
||||||
|
@ -51,7 +53,7 @@ function listener(exports: any, id: number) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.plugins.ContextMenuAPI.enabled) addListener(listener);
|
addListener(listener);
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "ContextMenuAPI",
|
name: "ContextMenuAPI",
|
||||||
|
|
Loading…
Reference in a new issue