plugin system
This commit is contained in:
21
src/main/core/PluginRegistry.js
Normal file
21
src/main/core/PluginRegistry.js
Normal file
@@ -0,0 +1,21 @@
|
||||
export default class PluginRegistry {
|
||||
constructor() {
|
||||
this.plugins = new Map()
|
||||
}
|
||||
|
||||
register(plugin) {
|
||||
if (!plugin.id) {
|
||||
throw new Error('Plugin must have an id')
|
||||
}
|
||||
|
||||
this.plugins.set(plugin.id, plugin)
|
||||
}
|
||||
|
||||
get(id) {
|
||||
return this.plugins.get(id)
|
||||
}
|
||||
|
||||
list() {
|
||||
return Array.from(this.plugins.values())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user