Extract webtorrent client in a module.

pull/18/head
Alex Kern 11 years ago
parent a930e35a35
commit c13f9712d1

@ -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 = () => {

@ -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({

@ -0,0 +1,3 @@
import WebTorrent from 'webtorrent'
export default new WebTorrent({})
Loading…
Cancel
Save