Vanessa 2024-01-06 15:30:34 +08:00
parent 6dd6d7401a
commit 1e3ca6bcde
3 changed files with 10 additions and 3 deletions

View file

@ -730,7 +730,7 @@ export const bazaar = {
this._genMyHTML(bazaarType, app);
bazaar._onBazaar(response, bazaarType, ["themes", "icons"].includes(bazaarType));
if (bazaarType === "plugins") {
uninstall(app, packageName);
uninstall(app, packageName, true);
}
});
});

View file

@ -74,7 +74,11 @@ export class Plugin {
}
public onunload() {
// 禁用/卸载
// 禁用/关闭
}
public uninstall() {
// 卸载
}
public onLayoutReady() {

View file

@ -3,12 +3,15 @@ import {Plugin} from "../plugin";
import {getAllModels} from "../layout/getAll";
import {resizeTopBar} from "../layout/util";
export const uninstall = (app: App, name: string) => {
export const uninstall = (app: App, name: string, isUninstall = false) => {
app.plugins.find((plugin: Plugin, index) => {
if (plugin.name === name) {
// rm command
try {
plugin.onunload();
if (isUninstall) {
plugin.uninstall();
}
} catch (e) {
console.error(`plugin ${plugin.name} onunload error:`, e);
}