diff --git a/lib/stores/DownloadStore.js b/lib/stores/DownloadStore.js index ffabbd5..786b406 100644 --- a/lib/stores/DownloadStore.js +++ b/lib/stores/DownloadStore.js @@ -1,5 +1,5 @@ import DownloadActions from '../actions/DownloadActions' -import WebTorrent from 'webtorrent' +import webtorrent from '../webtorrent' import alt from '../alt' import socket from 'filepizza-socket' @@ -34,8 +34,7 @@ export default alt.createStore(class DownloadStore { if (this.status !== 'ready') return this.status = 'requesting' - const client = new WebTorrent() - client.download(this.infoHash, (torrent) => { + webtorrent.download(this.infoHash, (torrent) => { this.setState({ status: 'downloading' }) const updateSpeed = () => { diff --git a/lib/stores/UploadStore.js b/lib/stores/UploadStore.js index 3f37d37..510974d 100644 --- a/lib/stores/UploadStore.js +++ b/lib/stores/UploadStore.js @@ -1,7 +1,7 @@ import UploadActions from '../actions/UploadActions' import alt from '../alt' import socket from 'filepizza-socket' -import WebTorrent from 'webtorrent' +import webtorrent from '../webtorrent' const SPEED_REFRESH_TIME = 2000 @@ -24,8 +24,7 @@ export default alt.createStore(class UploadStore { if (this.status !== 'ready') return this.status = 'processing' - const client = new WebTorrent() - client.seed(file, (torrent) => { + webtorrent.seed(file, (torrent) => { const updateSpeed = () => { this.setState({ diff --git a/lib/webtorrent.js b/lib/webtorrent.js new file mode 100644 index 0000000..6ee6237 --- /dev/null +++ b/lib/webtorrent.js @@ -0,0 +1,3 @@ +import WebTorrent from 'webtorrent' + +export default new WebTorrent({})