1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | class ConfigurationManager {
|
4 | constructor() {
|
5 | this._configUpdatedListeners = new Set();
|
6 | this._configuration = ConfigurationManager.defaultConfiguration;
|
7 | }
|
8 | get config() {
|
9 | return this._configuration;
|
10 | }
|
11 | equalTo(other) {
|
12 | return (this._configuration.enable === other.enable &&
|
13 | this._configuration.dtsPath === other.dtsPath &&
|
14 | this._configuration.import_map === other.import_map);
|
15 | }
|
16 | update(config) {
|
17 | this._configuration = Object.assign(Object.assign({}, this._configuration), config);
|
18 | if (!this.equalTo(config)) {
|
19 | for (const listener of this._configUpdatedListeners) {
|
20 | listener();
|
21 | }
|
22 | }
|
23 | }
|
24 | onUpdatedConfig(listener) {
|
25 | this._configUpdatedListeners.add(listener);
|
26 | }
|
27 | }
|
28 | exports.ConfigurationManager = ConfigurationManager;
|
29 | ConfigurationManager.defaultConfiguration = {
|
30 | enable: true,
|
31 | import_map: "",
|
32 | dtsPath: undefined,
|
33 | };
|
34 |
|
\ | No newline at end of file |