unleash-client
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2
@@ -16,3 +16,3 @@ const { Strategy, initialize, isEnabled } = require('../lib'); | ||
url: 'http://unleash.herokuapp.com/features', | ||
refreshIntervall: 10000, | ||
refreshInterval: 10000, | ||
strategies: [new ActiveForUserWithEmailStrategy()], | ||
@@ -19,0 +19,0 @@ }); |
@@ -10,3 +10,3 @@ /// <reference types="node" /> | ||
private etag; | ||
constructor(backupPath: string, url: string, refreshIntervall?: number, StorageImpl?: typeof Storage); | ||
constructor(backupPath: string, url: string, refreshInterval?: number, StorageImpl?: typeof Storage); | ||
validateFeature(feature: FeatureInterface): void; | ||
@@ -13,0 +13,0 @@ fetch(): void; |
@@ -13,3 +13,3 @@ 'use strict'; | ||
__extends(Repository, _super); | ||
function Repository(backupPath, url, refreshIntervall, StorageImpl) { | ||
function Repository(backupPath, url, refreshInterval, StorageImpl) { | ||
var _this = this; | ||
@@ -26,4 +26,4 @@ if (StorageImpl === void 0) { StorageImpl = storage_1.Storage; } | ||
process.nextTick(function () { return _this.fetch(); }); | ||
if (refreshIntervall > 0) { | ||
this.timer = setInterval(function () { return _this.fetch(); }, refreshIntervall); | ||
if (refreshInterval != null && refreshInterval > 0) { | ||
this.timer = setInterval(function () { return _this.fetch(); }, refreshInterval); | ||
this.timer.unref(); | ||
@@ -59,3 +59,3 @@ } | ||
if (res.statusCode !== 200) { | ||
return _this.emit('error', new Error('Reponse was not statusCode 200')); | ||
return _this.emit('error', new Error('Response was not statusCode 200')); | ||
} | ||
@@ -62,0 +62,0 @@ try { |
@@ -7,3 +7,3 @@ /// <reference types="node" /> | ||
url: string; | ||
refreshIntervall?: number; | ||
refreshInterval?: number; | ||
backupPath?: string; | ||
@@ -16,5 +16,5 @@ strategies: Strategy[]; | ||
private client; | ||
constructor({url, refreshIntervall, backupPath, strategies, errorHandler}: UnleashConfig); | ||
constructor({url, refreshInterval, backupPath, strategies, errorHandler}: UnleashConfig); | ||
destroy(): void; | ||
isEnabled(name: string, context: any, fallbackValue?: boolean): boolean; | ||
} |
@@ -20,3 +20,3 @@ 'use strict'; | ||
var _this = this; | ||
var url = _a.url, _b = _a.refreshIntervall, refreshIntervall = _b === void 0 ? 15 * 1000 : _b, _c = _a.backupPath, backupPath = _c === void 0 ? BACKUP_PATH : _c, _d = _a.strategies, strategies = _d === void 0 ? [] : _d, _e = _a.errorHandler, errorHandler = _e === void 0 ? function () { } : _e; | ||
var url = _a.url, _b = _a.refreshInterval, refreshInterval = _b === void 0 ? 15 * 1000 : _b, _c = _a.backupPath, backupPath = _c === void 0 ? BACKUP_PATH : _c, _d = _a.strategies, strategies = _d === void 0 ? [] : _d, _e = _a.errorHandler, errorHandler = _e === void 0 ? function () { } : _e; | ||
_super.call(this); | ||
@@ -26,3 +26,3 @@ if (!url) { | ||
} | ||
this.repository = new repository_1["default"](backupPath, url, refreshIntervall); | ||
this.repository = new repository_1["default"](backupPath, url, refreshInterval); | ||
this.repository.on('error', function (err) { | ||
@@ -38,9 +38,7 @@ _this.emit('error', err); | ||
Unleash.prototype.destroy = function () { | ||
if (this.repository) { | ||
this.repository.stop(); | ||
} | ||
this.repository.stop(); | ||
this.client = undefined; | ||
}; | ||
Unleash.prototype.isEnabled = function (name, context, fallbackValue) { | ||
if (this.client) { | ||
if (this.client !== undefined) { | ||
return this.client.isEnabled(name, context, fallbackValue); | ||
@@ -50,3 +48,3 @@ } | ||
var returnValue = typeof fallbackValue === 'boolean' ? fallbackValue : false; | ||
this.emit('warn', "Unleash has not been initalized yet. isEnabled(" + name + ") defaulted to " + returnValue); | ||
this.emit('warn', "Unleash has not been initialized yet. isEnabled(" + name + ") defaulted to " + returnValue); | ||
return returnValue; | ||
@@ -53,0 +51,0 @@ } |
{ | ||
"name": "unleash-client", | ||
"version": "1.0.0-alpha.1", | ||
"version": "1.0.0-alpha.2", | ||
"description": "Unleash Client for Node", | ||
@@ -8,4 +8,4 @@ "main": "lib/index", | ||
"lint": "eslint .", | ||
"build": "tsc src/*.ts -d --sourceMap --outdir ./lib --lib ES6,ES5", | ||
"postinstall": "npm run build", | ||
"build": "tsc src/*.ts -d --strictNullChecks --sourceMap --outdir ./lib --lib ES6,ES5", | ||
"prepublish": "not-in-install && npm run build || in-install", | ||
"test": "ava test", | ||
@@ -33,3 +33,3 @@ "coverage": "nyc --check-coverage=true npm test", | ||
"engines": { | ||
"node": "6" | ||
"node": ">=6" | ||
}, | ||
@@ -47,2 +47,3 @@ "files": [ | ||
"eslint-config-finn": "^1.0.0-alpha.9", | ||
"in-publish": "^2.0.0", | ||
"mkdirp": "^0.5.1", | ||
@@ -49,0 +50,0 @@ "nock": "^1.2.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
32636
0
0
11
472