chore(): readme notes on browser usage
This commit is contained in:
34
README.md
34
README.md
@@ -329,15 +329,43 @@ In rare situations, you may want to see the raw HTTP requets being built as well
|
|||||||
|
|
||||||
## Browser Usage
|
## Browser Usage
|
||||||
|
|
||||||
|
### Import
|
||||||
|
|
||||||
|
This is the "modern" way, allowing the package to be directly imported into frontend projects with full typescript support.
|
||||||
|
|
||||||
|
1. Install these dependencies
|
||||||
|
```sh
|
||||||
|
npm install crypto-browserify stream-browserify
|
||||||
|
```
|
||||||
|
2. Add this to your `tsconfig.json`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"paths": {
|
||||||
|
"crypto": [
|
||||||
|
"./node_modules/crypto-browserify"
|
||||||
|
],
|
||||||
|
"stream": [
|
||||||
|
"./node_modules/stream-browserify"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
3. Declare this in the global context of your application (ex: in polyfills for angular)
|
||||||
|
```js
|
||||||
|
(window as any).global = window;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Webpack
|
||||||
|
|
||||||
|
This is the "old" way of using this package on webpages. This will build a minified js bundle that can be pulled in using a script tag on a website.
|
||||||
|
|
||||||
Build a bundle using webpack:
|
Build a bundle using webpack:
|
||||||
|
|
||||||
- `npm install`
|
- `npm install`
|
||||||
- `npm build`
|
- `npm build`
|
||||||
- `npm pack`
|
- `npm pack`
|
||||||
|
|
||||||
The bundle can be found in `dist/`. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO.
|
The bundle can be found in `dist/`. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO - contributions welcome.
|
||||||
|
|
||||||
However, note that browser usage will lead to CORS errors due Bybit. See [issue #79](#79) for more information & alternative suggestions.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user