refactor: ui prepare

This commit is contained in:
xiaojunnuo
2021-01-21 23:59:06 +08:00
parent c26417d769
commit d3619ad60f
17 changed files with 292 additions and 245 deletions
@@ -0,0 +1,27 @@
export class PluginRegistry {
constructor () {
this.plugins = {}
}
install (plugin) {
if (plugin == null) {
return
}
if (this.plugins == null) {
this.plugins = {}
}
const name = plugin.name || (plugin.define && plugin.define.name)
this.plugins[name] = plugin
}
get (name) {
if (name) {
return this.plugins[name]
}
throw new Error(`找不到${name}插件`)
}
}
export const pluginRegistry = new PluginRegistry()