configdn-js
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -20,4 +20,6 @@ import { __awaiter, __generator } from "tslib"; | ||
this.TimerID = null; | ||
this.firstRefresh = null; | ||
this.hasDoneRefresh = false; | ||
this.settings = new Settings(authKey, apiEndpoint, refreshInterval); | ||
this.refreshConfig(true); | ||
this.firstRefresh = this.refreshConfig(true).then(function (v) { _this.hasDoneRefresh = true; return v; }); | ||
this.lastUpdate = Date.now() / 1000; | ||
@@ -105,14 +107,23 @@ this.TimerID = setInterval(function () { | ||
return __generator(this, function (_a) { | ||
if (this.fetchedConfig.has(key)) { | ||
return [2 /*return*/, (this.fetchedConfig.get(key)["v"])]; | ||
switch (_a.label) { | ||
case 0: | ||
if (!!this.hasDoneRefresh) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.firstRefresh]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: | ||
if (this.fetchedConfig.has(key)) { | ||
return [2 /*return*/, (this.fetchedConfig.get(key)["v"])]; | ||
} | ||
else { | ||
if (defaultValue !== null) { | ||
return [2 /*return*/, defaultValue]; | ||
} | ||
else { | ||
throw new Error("Key not in config"); | ||
} | ||
} | ||
return [2 /*return*/]; | ||
} | ||
else { | ||
if (defaultValue !== null) { | ||
return [2 /*return*/, defaultValue]; | ||
} | ||
else { | ||
throw new Error("Key not in config"); | ||
} | ||
} | ||
return [2 /*return*/]; | ||
}); | ||
@@ -119,0 +130,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
export default "0.3.1"; | ||
export default "0.3.2"; |
@@ -9,2 +9,4 @@ import { Settings } from "./Settings"; | ||
private TimerID; | ||
private firstRefresh; | ||
private hasDoneRefresh; | ||
/** | ||
@@ -11,0 +13,0 @@ * Creates a new instance |
@@ -23,4 +23,6 @@ "use strict"; | ||
this.TimerID = null; | ||
this.firstRefresh = null; | ||
this.hasDoneRefresh = false; | ||
this.settings = new Settings_1.Settings(authKey, apiEndpoint, refreshInterval); | ||
this.refreshConfig(true); | ||
this.firstRefresh = this.refreshConfig(true).then(function (v) { _this.hasDoneRefresh = true; return v; }); | ||
this.lastUpdate = Date.now() / 1000; | ||
@@ -108,14 +110,23 @@ this.TimerID = setInterval(function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
if (this.fetchedConfig.has(key)) { | ||
return [2 /*return*/, (this.fetchedConfig.get(key)["v"])]; | ||
switch (_a.label) { | ||
case 0: | ||
if (!!this.hasDoneRefresh) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.firstRefresh]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: | ||
if (this.fetchedConfig.has(key)) { | ||
return [2 /*return*/, (this.fetchedConfig.get(key)["v"])]; | ||
} | ||
else { | ||
if (defaultValue !== null) { | ||
return [2 /*return*/, defaultValue]; | ||
} | ||
else { | ||
throw new Error("Key not in config"); | ||
} | ||
} | ||
return [2 /*return*/]; | ||
} | ||
else { | ||
if (defaultValue !== null) { | ||
return [2 /*return*/, defaultValue]; | ||
} | ||
else { | ||
throw new Error("Key not in config"); | ||
} | ||
} | ||
return [2 /*return*/]; | ||
}); | ||
@@ -122,0 +133,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = "0.3.1"; | ||
exports.default = "0.3.2"; |
{ | ||
"name": "configdn-js", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "ConfigDN lets you change configuration settings without deploying new code.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
93869
521