Skip to content

Commit

Permalink
feat: support remove plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nyqykk committed Jul 12, 2024
1 parent 6d8ac4d commit 99861bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/core/src/garfish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export class Garfish extends EventEmitter2 {
return this;
}

removePlugin(pluginName: string) {
this.hooks.removePlugin(pluginName);
}

run(options: interfaces.Options = {}) {
if (this.running) {
if (__DEV__) {
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/pluginSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class PluginSystem<T extends Record<string, any>> {
assert(plugin, `plugin "${pluginName}" is not registered.`);

for (const key in plugin) {
if (key === 'name') continue;
if (key !== 'name') continue;
this.lifecycle[key].remove(plugin[key as string]);
}
}
Expand Down

0 comments on commit 99861bc

Please sign in to comment.