Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: typescript browser usage #258

Closed
Badisi opened this issue May 10, 2023 · 3 comments
Closed

Documentation: typescript browser usage #258

Badisi opened this issue May 10, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@Badisi
Copy link

Badisi commented May 10, 2023

For anyone interested, this is how I managed to get the lib working with typescript in a browser environment (without the need to build it as suggested in the README).

  1. Install these dependencies
    npm install crypto-browserify stream-browserify
  2. Add this to your tsconfig.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)
    (window as any).global = window;
@Badisi
Copy link
Author

Badisi commented May 10, 2023

@tiagosiebler, maybe this could be documented somewhere.

PS: I also think that the warning about CORS in the README could be removed as it seems it was resolved (and I did not encounter any issues with it myself)

@tiagosiebler
Copy link
Owner

This is wonderful, thank you for sharing this! I've wanted to explore a more friendly way of importing my SDKs in frontend projects but never got around to it. Do websockets work as well?

Absolutely agree on the documentation, would like to get this added to the readme, since I think that's the first place many would look. Regarding CORS, also a good point - bybit added full CORS support, I think that was sometime last year.

@tiagosiebler
Copy link
Owner

Closing this, added it to readme a while ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants