mirror of
https://github.com/certd/certd.git
synced 2026-04-23 11:37:23 +08:00
refactor: ui prepare
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user