mirror of
https://github.com/certd/certd.git
synced 2026-05-15 12:37:30 +08:00
fix: 修复插件修改名字和删除后没有注销注册的bug
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user