UNPKG

655 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3class PluginRegistry {
4 constructor() {
5 this.registry = {};
6 }
7 register(plugin) {
8 if (plugin.id in this.registry) {
9 throw new Error('Plugin already exists');
10 }
11 this.registry[plugin.id] = plugin;
12 }
13 get(id) {
14 return this.registry[id];
15 }
16 async dispose() {
17 for (const [name, plugin] of Object.entries(this.registry)) {
18 await plugin.dispose();
19 delete this.registry[name];
20 }
21 }
22}
23exports.PluginRegistry = PluginRegistry;
24//# sourceMappingURL=pluginRegistry.js.map
\No newline at end of file