1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | class 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 | }
|
23 | exports.PluginRegistry = PluginRegistry;
|
24 |
|
\ | No newline at end of file |