perf: 优化文件下载包名

This commit is contained in:
xiaojunnuo
2024-05-30 10:12:48 +08:00
parent 39ad7597fa
commit d9eb927b0a
17 changed files with 48 additions and 30 deletions
@@ -1,3 +1,5 @@
import { logger } from "../utils";
export type Registrable = {
name: string;
title: string;
@@ -9,15 +11,21 @@ export type RegistryItem<T> = {
target: T;
};
export class Registry<T> {
type = "";
storage: {
[key: string]: RegistryItem<T>;
} = {};
constructor(type: string) {
this.type = type;
}
register(key: string, value: RegistryItem<T>) {
if (!key || value == null) {
return;
}
this.storage[key] = value;
logger.info(`注册插件:${this.type}:${key}`);
}
get(name: string): RegistryItem<T> {