aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/app/videos/video-watch/webtorrent.service.ts
blob: 0c73ab4f46b848d9928957e09f6efcf23f17c27d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Don't use webtorrent typings for now
// It misses some little things I'll fix later
// <reference path="../../../typings/globals/webtorrent/index.d.ts" />

import { Injectable } from '@angular/core';

// import WebTorrent = require('webtorrent');
declare var WebTorrent: any;

@Injectable()
export class WebTorrentService {
  // private client: WebTorrent.Client;
  private client: any;

  constructor() {
    this.client = new WebTorrent({ dht: false });
  }

  add(magnetUri: string, callback: Function) {
    return this.client.add(magnetUri, callback);
  }

  remove(magnetUri: string) {
    return this.client.remove(magnetUri);
  }
}