@waves.exchange/config-ws
Advanced tools
Comparing version 0.0.4 to 0.0.5
import { BehaviorSubject } from '@waves.exchange/reactive'; | ||
declare type ConfigState = { | ||
configs: Record<string, Record<any, any>>; | ||
}; | ||
import { ConfigState } from './types'; | ||
export declare class WsConfigService { | ||
configSubject: BehaviorSubject<ConfigState>; | ||
private _url; | ||
private readonly _url; | ||
private _configWebSocket; | ||
@@ -16,3 +14,2 @@ private _connectConfigTimeout; | ||
} | ||
export {}; | ||
//# sourceMappingURL=configUpdates.d.ts.map |
@@ -9,2 +9,3 @@ "use strict"; | ||
const RECONNECT_TIMEOUT = 5000; | ||
const isEmpty = (object) => Object.keys(object).length === 0 && object.constructor === Object; | ||
class WsConfigService { | ||
@@ -27,3 +28,3 @@ constructor(url) { | ||
onOpen: () => { | ||
if (this.configSubject.observers.length) { | ||
if (!isEmpty(this.configSubject.getValue().configs)) { | ||
const oldConfigs = this.configSubject.getValue().configs; | ||
@@ -63,3 +64,3 @@ if (oldConfigs) { | ||
const errString = err instanceof CloseEvent ? (err.reason || err.code) : String(err); | ||
console.error('Config WS Error: %s', errString); | ||
console.error('Config WS Ping Error: %s', errString); | ||
}); | ||
@@ -74,3 +75,3 @@ } | ||
this.configSubject.next({ | ||
configs: Object.assign(Object.assign({}, oldConfigs), { [filePath]: data.value ? JSON.parse(data.value) : undefined }) | ||
configs: Object.assign(Object.assign({}, oldConfigs), { [filePath]: data === null || data === void 0 ? void 0 : data.value }) | ||
}); | ||
@@ -77,0 +78,0 @@ }); |
{ | ||
"name": "@waves.exchange/config-ws", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
15184
17
275