mm_config 2.3.4 → 2.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -190,7 +190,7 @@ Config.prototype.getAsyncProxy = function () {
|
|
|
190
190
|
* @param {string} key - 配置键
|
|
191
191
|
* @returns {*} 配置值
|
|
192
192
|
*/
|
|
193
|
-
Config.prototype.get =
|
|
193
|
+
Config.prototype.get = function (key) {
|
|
194
194
|
return this.options[key];
|
|
195
195
|
};
|
|
196
196
|
|
|
@@ -238,6 +238,15 @@ Config.prototype.destroy = function () {
|
|
|
238
238
|
delete dict[this.config.file];
|
|
239
239
|
};
|
|
240
240
|
|
|
241
|
+
/**
|
|
242
|
+
* 从配置文件加载配置
|
|
243
|
+
* @returns {boolean} 加载是否成功
|
|
244
|
+
*/
|
|
245
|
+
Config.prototype.load = function () {
|
|
246
|
+
if (!this.config.file) return false;
|
|
247
|
+
this.options = this.config.file.loadJson() || {};
|
|
248
|
+
};
|
|
249
|
+
|
|
241
250
|
/**
|
|
242
251
|
* 创建配置(同步)
|
|
243
252
|
* @param {string} file - 配置文件路径
|