refactor: 重构

This commit is contained in:
xiaojunnuo
2021-02-08 13:40:28 +08:00
parent 82f86d9556
commit cb8c8186f1
38 changed files with 807 additions and 1895 deletions
+10 -3
View File
@@ -26,11 +26,18 @@ export class Registry {
}
get (name) {
if (name) {
return this.collection[name]
if (!name) {
throw new Error('插件名称不能为空')
}
throw new Error(`${name} cant blank`)
if (!this.collection) {
this.collection = {}
}
const plugin = this.collection[name]
if (!plugin) {
throw new Error(`插件${name}还未注册`)
}
return plugin
}
getCollection () {