UNPKG

1.11 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3class 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}
28exports.ConfigurationManager = ConfigurationManager;
29ConfigurationManager.defaultConfiguration = {
30 enable: true,
31 import_map: "",
32 dtsPath: undefined,
33};
34//# sourceMappingURL=configuration.js.map
\No newline at end of file