[API] Cleanup

This commit is contained in:
Beef 2023-01-08 23:24:00 +00:00
parent 488cc76dda
commit ad2c3573ed
3 changed files with 19 additions and 4 deletions

8
src/def.d.ts vendored
View file

@ -112,6 +112,14 @@ interface VendettaObject {
getAssetIDByName: (name: string) => number;
};
};
plugins: {
plugins: Indexable<Plugin>;
fetchPlugin: (id: string) => void;
evalPlugin: (id: string) => void;
stopPlugin: (id: string) => void;
removePlugin: (id: string) => void;
getSettings: (id: string) => JSX.Element;
}
logger: Logger;
}

View file

@ -8,11 +8,10 @@ import * as metro from "@metro/filters";
import * as common from "@metro/common";
import * as components from "@ui/components";
import * as toasts from "@ui/toasts";
import { all, find, getAssetByID, getAssetByName, getAssetIDByName } from "@ui/assets";
import patchAssets from "@ui/assets";
import { patchAssets, all, find, getAssetByID, getAssetByName, getAssetIDByName } from "@ui/assets";
import initSettings from "@ui/settings";
import { connectToDebugger, patchLogHook } from "@lib/debug";
import { initPlugins } from "@lib/plugins";
import { initPlugins, plugins, fetchPlugin, evalPlugin, stopPlugin, removePlugin, getSettings } from "@lib/plugins";
console.log("Hello from Vendetta!");
@ -43,6 +42,14 @@ async function init() {
getAssetIDByName: getAssetIDByName,
},
},
plugins: {
plugins: plugins,
fetchPlugin: fetchPlugin,
evalPlugin: evalPlugin,
stopPlugin: stopPlugin,
removePlugin: removePlugin,
getSettings: getSettings
},
logger: logger,
};

View file

@ -4,7 +4,7 @@ import { assets } from "@metro/common";
export const all: Indexable<Asset> = {};
export default function patchAssets() {
export function patchAssets() {
try {
after("registerAsset", assets, (args: Asset[], id: number) => {
const asset = args[0];