diff options
Diffstat (limited to 'client/src/app/videos/video-watch/webtorrent.service.ts')
-rw-r--r-- | client/src/app/videos/video-watch/webtorrent.service.ts | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/client/src/app/videos/video-watch/webtorrent.service.ts b/client/src/app/videos/video-watch/webtorrent.service.ts index 8936e7992..211894bfd 100644 --- a/client/src/app/videos/video-watch/webtorrent.service.ts +++ b/client/src/app/videos/video-watch/webtorrent.service.ts | |||
@@ -1,33 +1,33 @@ | |||
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core' |
2 | import { Subject } from 'rxjs/Subject'; | 2 | import { Subject } from 'rxjs/Subject' |
3 | 3 | ||
4 | import * as WebTorrent from 'webtorrent'; | 4 | import * as WebTorrent from 'webtorrent' |
5 | 5 | ||
6 | @Injectable() | 6 | @Injectable() |
7 | export class WebTorrentService { | 7 | export class WebTorrentService { |
8 | errors = new Subject<Error>(); | 8 | errors = new Subject<Error>() |
9 | warnings = new Subject<Error>(); | 9 | warnings = new Subject<Error>() |
10 | 10 | ||
11 | // TODO: use WebTorrent @type | 11 | // TODO: use WebTorrent @type |
12 | // private client: WebTorrent.Client; | 12 | // private client: WebTorrent.Client |
13 | private client: any; | 13 | private client: any |
14 | 14 | ||
15 | constructor() { | 15 | constructor () { |
16 | this.client = new WebTorrent({ dht: false }); | 16 | this.client = new WebTorrent({ dht: false }) |
17 | 17 | ||
18 | this.client.on('error', (err) => this.errors.next(err)); | 18 | this.client.on('error', (err) => this.errors.next(err)) |
19 | this.client.on('warning', (err) => this.warnings.next(err)); | 19 | this.client.on('warning', (err) => this.warnings.next(err)) |
20 | } | 20 | } |
21 | 21 | ||
22 | add(magnetUri: string, callback: Function) { | 22 | add (magnetUri: string, callback: Function) { |
23 | return this.client.add(magnetUri, callback); | 23 | return this.client.add(magnetUri, callback) |
24 | } | 24 | } |
25 | 25 | ||
26 | remove(magnetUri: string) { | 26 | remove (magnetUri: string) { |
27 | return this.client.remove(magnetUri); | 27 | return this.client.remove(magnetUri) |
28 | } | 28 | } |
29 | 29 | ||
30 | has(magnetUri: string) { | 30 | has (magnetUri: string) { |
31 | return this.client.get(magnetUri) !== null; | 31 | return this.client.get(magnetUri) !== null |
32 | } | 32 | } |
33 | } | 33 | } |