fix: 修复插件修改名字和删除后没有注销注册的bug

This commit is contained in:
xiaojunnuo
2026-01-20 11:52:14 +08:00
parent 5ea2b09dc3
commit 61192b998a
3 changed files with 28 additions and 7 deletions
+12 -1
View File
@@ -22,4 +22,15 @@ const onRegister = ({ key, value }: OnRegisterContext<AbstractTaskPlugin>) => {
}
pluginGroups.other.plugins.push(value.define);
};
export const pluginRegistry = createRegistry<AbstractTaskPlugin>("plugin", onRegister);
const onUnRegister = ({ key }: OnRegisterContext<AbstractTaskPlugin>) => {
for (const group of Object.values(pluginGroups)) {
const index = group.plugins.findIndex(plugin => plugin.name === key);
if (index > -1) {
group.plugins.splice(index, 1);
return;
}
}
};
export const pluginRegistry = createRegistry<AbstractTaskPlugin>("plugin", onRegister, onUnRegister);