aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2017-12-20 13:44:08 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-12-20 22:30:25 +0800
commitcb11aec84df346d5180c7d5874859c1c34f0bf1c (patch)
treeb959a65bdcfc3e8b01dca1bc160f93a0df8a4bf9 /packages/connect/src
parent972e1675f6490bc10e8d9fd64cce2f7945cd4840 (diff)
downloaddexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar
dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.gz
dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.bz2
dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.lz
dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.xz
dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.zst
dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.zip
Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors
Diffstat (limited to 'packages/connect/src')
-rw-r--r--packages/connect/src/http_client.ts6
-rw-r--r--packages/connect/src/ws_orderbook_channel.ts34
2 files changed, 20 insertions, 20 deletions
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index 252c9e9dd..3bada2be0 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -31,7 +31,7 @@ BigNumber.config({
* that implement the standard relayer API v0
*/
export class HttpClient implements Client {
- private apiEndpointUrl: string;
+ private _apiEndpointUrl: string;
/**
* Instantiates a new HttpClient instance
* @param url The relayer API base HTTP url you would like to interact with
@@ -39,7 +39,7 @@ export class HttpClient implements Client {
*/
constructor(url: string) {
assert.isHttpUrl('url', url);
- this.apiEndpointUrl = url;
+ this._apiEndpointUrl = url;
}
/**
* Retrieve token pair info from the API
@@ -152,7 +152,7 @@ export class HttpClient implements Client {
const stringifiedParams = queryString.stringify(params);
query = `?${stringifiedParams}`;
}
- const url = `${this.apiEndpointUrl}/v0${path}${query}`;
+ const url = `${this._apiEndpointUrl}/v0${path}${query}`;
const headers = new Headers({
'content-type': 'application/json',
});
diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts
index f58593484..a669d8094 100644
--- a/packages/connect/src/ws_orderbook_channel.ts
+++ b/packages/connect/src/ws_orderbook_channel.ts
@@ -18,10 +18,10 @@ import {orderbookChannelMessageParsers} from './utils/orderbook_channel_message_
* that implements the standard relayer API v0
*/
export class WebSocketOrderbookChannel implements OrderbookChannel {
- private apiEndpointUrl: string;
- private client: WebSocket.client;
- private connectionIfExists?: WebSocket.connection;
- private subscriptionCounter = 0;
+ private _apiEndpointUrl: string;
+ private _client: WebSocket.client;
+ private _connectionIfExists?: WebSocket.connection;
+ private _subscriptionCounter = 0;
/**
* Instantiates a new WebSocketOrderbookChannel instance
* @param url The relayer API base WS url you would like to interact with
@@ -29,8 +29,8 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
*/
constructor(url: string) {
assert.isUri('url', url);
- this.apiEndpointUrl = url;
- this.client = new WebSocket.client();
+ this._apiEndpointUrl = url;
+ this._client = new WebSocket.client();
}
/**
* Subscribe to orderbook snapshots and updates from the websocket
@@ -46,11 +46,11 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
assert.isFunction('handler.onUpdate', _.get(handler, 'onUpdate'));
assert.isFunction('handler.onError', _.get(handler, 'onError'));
assert.isFunction('handler.onClose', _.get(handler, 'onClose'));
- this.subscriptionCounter += 1;
+ this._subscriptionCounter += 1;
const subscribeMessage = {
type: 'subscribe',
channel: 'orderbook',
- requestId: this.subscriptionCounter,
+ requestId: this._subscriptionCounter,
payload: subscriptionOpts,
};
this._getConnection((error, connection) => {
@@ -74,22 +74,22 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
* Close the websocket and stop receiving updates
*/
public close() {
- if (!_.isUndefined(this.connectionIfExists)) {
- this.connectionIfExists.close();
+ if (!_.isUndefined(this._connectionIfExists)) {
+ this._connectionIfExists.close();
}
}
private _getConnection(callback: (error?: Error, connection?: WebSocket.connection) => void) {
- if (!_.isUndefined(this.connectionIfExists) && this.connectionIfExists.connected) {
- callback(undefined, this.connectionIfExists);
+ if (!_.isUndefined(this._connectionIfExists) && this._connectionIfExists.connected) {
+ callback(undefined, this._connectionIfExists);
} else {
- this.client.on(WebsocketClientEventType.Connect, connection => {
- this.connectionIfExists = connection;
- callback(undefined, this.connectionIfExists);
+ this._client.on(WebsocketClientEventType.Connect, connection => {
+ this._connectionIfExists = connection;
+ callback(undefined, this._connectionIfExists);
});
- this.client.on(WebsocketClientEventType.ConnectFailed, error => {
+ this._client.on(WebsocketClientEventType.ConnectFailed, error => {
callback(error, undefined);
});
- this.client.connect(this.apiEndpointUrl);
+ this._client.connect(this._apiEndpointUrl);
}
}
private _handleWebSocketMessage(requestId: number, subscriptionOpts: OrderbookChannelSubscriptionOpts,