configcat-common
Advanced tools
Comparing version 1.1.7 to 1.1.8
@@ -19,3 +19,2 @@ "use strict"; | ||
_this.timer = setInterval(function () { return _this.refreshConfig(); }, autoPollConfig.pollIntervalSeconds * 1000); | ||
_this.maxInitWaitExpire = new Date(new Date().getTime() + autoPollConfig.maxInitWaitTimeSeconds * 1000); | ||
_this.configChanged = autoPollConfig.configChanged; | ||
@@ -26,3 +25,3 @@ return _this; | ||
var p = this.cache.Get(this.baseConfig.apiKey); | ||
if (!p && new Date().getTime() < this.maxInitWaitExpire.getTime()) { | ||
if (!p) { | ||
this.refreshLogic(callback); | ||
@@ -29,0 +28,0 @@ } |
import { IConfigCatLogger, IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions } from "."; | ||
export interface IOptions { | ||
logger?: IConfigCatLogger; | ||
requestTimeoutMs?: number; | ||
} | ||
@@ -9,2 +10,3 @@ export declare abstract class OptionsBase implements IOptions { | ||
clientVersion: string; | ||
requestTimeoutMs: number; | ||
constructor(apiKey: string, clientVersion: string, options: IOptions); | ||
@@ -15,3 +17,2 @@ getUrl(): string; | ||
pollIntervalSeconds: number; | ||
maxInitWaitTimeSeconds: number; | ||
configChanged: () => void; | ||
@@ -18,0 +19,0 @@ constructor(apiKey: string, options: IAutoPollOptions); |
@@ -18,2 +18,3 @@ "use strict"; | ||
this.logger = new ConfigCatLogger_1.ConfigCatConsoleLogger(); | ||
this.requestTimeoutMs = 30000; | ||
if (!apiKey) { | ||
@@ -24,4 +25,12 @@ throw new Error("Invalid 'apiKey' value"); | ||
this.clientVersion = clientVersion; | ||
if (options && options.logger) { | ||
this.logger = options.logger; | ||
if (options) { | ||
if (options.logger) { | ||
this.logger = options.logger; | ||
} | ||
if (options.requestTimeoutMs) { | ||
if (options.requestTimeoutMs < 0) { | ||
throw new Error("Invalid 'requestTimeoutMs' value"); | ||
} | ||
this.requestTimeoutMs = options.requestTimeoutMs; | ||
} | ||
} | ||
@@ -40,8 +49,4 @@ } | ||
_this.pollIntervalSeconds = 60; | ||
_this.maxInitWaitTimeSeconds = 5; | ||
_this.configChanged = function () { }; | ||
if (options) { | ||
if (options.maxInitWaitTimeSeconds) { | ||
_this.maxInitWaitTimeSeconds = options.maxInitWaitTimeSeconds; | ||
} | ||
if (options.pollIntervalSeconds) { | ||
@@ -54,5 +59,2 @@ _this.pollIntervalSeconds = options.pollIntervalSeconds; | ||
} | ||
if (!_this.maxInitWaitTimeSeconds || _this.maxInitWaitTimeSeconds < 1) { | ||
throw new Error("Invalid 'maxInitWaitTimeSeconds' value"); | ||
} | ||
if (!_this.pollIntervalSeconds || _this.pollIntervalSeconds < 1) { | ||
@@ -59,0 +61,0 @@ throw new Error("Invalid 'pollIntervalSeconds' value"); |
@@ -24,3 +24,2 @@ import { IConfigCatClient } from "./ConfigCatClient"; | ||
pollIntervalSeconds?: number; | ||
maxInitWaitTimeSeconds?: number; | ||
configChanged?: () => void; | ||
@@ -27,0 +26,0 @@ } |
{ | ||
"name": "configcat-common", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "ConfigCat is a configuration as a service that lets you manage your features and configurations without actually deploying new code.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
657
31834