From 976ff20437846feda4301d5f8e5b2ae5dbad5d18 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Sat, 26 Dec 2020 17:51:15 +0000 Subject: [PATCH] cleaning & docs --- README.md | 12 ++++++------ src/websocket-client.ts | 5 ----- tsconfig.json | 8 ++++---- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2495348e..2d75d553 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [1]: https://www.npmjs.com/package/bybit-api -A production-ready Node.js connector for the Bybit APIs and WebSockets. +A production-ready Node.js connector for the Bybit APIs and WebSockets, with TypeScript & browser support. ## Installation `npm install --save bybit-api` @@ -36,12 +36,12 @@ Build a bundle using webpack: - `npm build` - `npm pack` -The bundle can be found in `lib/`. Altough usage should be largely consistent, smaller differences will exist. Docs TBC. +The bundle can be found in `dist/`. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO. ### Inverse Contracts #### Rest client ```javascript -const {RestClient} = require('bybit-api'); +const { RestClient } = require('bybit-api'); const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy'; @@ -88,11 +88,11 @@ client.changeUserLeverage({leverage: 4, symbol: 'ETHUSD'}) }); ``` -See inverse [rest-client.js](./lib/rest-client.js) for further information. +See inverse [rest-client.ts](./src/rest-client.ts) for further information. #### Websocket client ```javascript -const {WebsocketClient} = require('bybit-api'); +const { WebsocketClient } = require('bybit-api'); const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy'; @@ -150,7 +150,7 @@ ws.on('error', err => { console.error('ERR', err); }); ``` -See inverse [websocket-client.js](./lib/websocket-client.js) & [ws api docs](./doc/websocket-client.md) for further information. +See inverse [websocket-client.ts](./src/websocket-client.ts) for further information. ### Customise Logging Pass a custom logger which supports the log methods `silly`, `debug`, `notice`, `info`, `warning` and `error`, or override methods from the default logger as desired: diff --git a/src/websocket-client.ts b/src/websocket-client.ts index 8534ee20..8b80c80f 100644 --- a/src/websocket-client.ts +++ b/src/websocket-client.ts @@ -105,11 +105,6 @@ export class WebsocketClient extends EventEmitter { const ws = new WebSocket(url); - // ws.onopen!(this._wsOpenHandler.bind(this)); - // ws.onmessage!(this._wsMessageHandler.bind(this)); - // ws.onerror!(this._wsOnErrorHandler.bind(this)); - // ws.onclose!(this._wsCloseHandler.bind(this)); - ws.onopen = this._wsOpenHandler.bind(this); ws.onmessage = this._wsMessageHandler.bind(this); ws.onerror = this._wsOnErrorHandler.bind(this); diff --git a/tsconfig.json b/tsconfig.json index 4be19e11..02c8de22 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,21 +1,21 @@ { "compileOnSave": true, "compilerOptions": { - "declaration": true, "allowJs": true, "target": "es6", - "moduleResolution": "node", "module": "commonjs", - "outDir": "lib", + "moduleResolution": "node", + "declaration": true, + "sourceMap": true, "removeComments": false, "noEmitOnError": true, "noImplicitAny": false, "strictNullChecks": true, "skipLibCheck": true, - "sourceMap": true, "esModuleInterop": true, "lib": ["es2017","dom"], "baseUrl": ".", + "outDir": "lib", "paths": { "@src/*": ["src/*"] }