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

TypeScript support? #1230

Closed
ghost opened this issue Nov 24, 2017 · 3 comments
Closed

TypeScript support? #1230

ghost opened this issue Nov 24, 2017 · 3 comments

Comments

@ghost
Copy link

@ghost ghost commented Nov 24, 2017

Apologies as this has probably been requested before.
Are there any plans for TypeScript support? I'd imagine a few people have gone and made their own fork, but I would like something official and up to date. Even just a declarations file (.d.ts) would be great, as I'm currently being forced to use the any type.

Thanks.

EDIT (unrelated)
I have just noticed that WebTorrent makes constant HTTP requests in 128kb chunks to get the torrent data. Is it possible for this to be done over WebSocket? Not sure exactly how it works.

@transitive-bullshit

This comment has been minimized.

Copy link
Member

@transitive-bullshit transitive-bullshit commented Nov 24, 2017

I don't believe there is any official task to add typescript definitions, but this would be a great opportunity to contribute w/ a PR :)

As for the HTTP requests, webtorrent mainly operates over WebRTC data channels meaning it doesn't make any normal HTTP or websocket requests. This is due to our attempt to interop with the original bittorrent spec as closely as possible within the confines of the web. If you're interested in learning more about how webtorrent does its magic under the hood, I'd recommend watching one of Feross' excellent talks listed on the bottom of the main page.

@alxhotel

This comment has been minimized.

Copy link
Member

@alxhotel alxhotel commented Nov 25, 2017

@IwHy4XnXCM I believe you can use this npm module: @types/webtorrent

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Nov 26, 2017

First question, no. But you can use what @alxhotel linked.

Second: Yes, it's something I've been wanting to do since I did the http reimplementation.

@lock lock bot locked as resolved and limited conversation to collaborators May 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.