diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2014-07-29 12:09:55 +0400 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2014-07-29 12:09:55 +0400 |
commit | a1ba43c6598c392e35c029a11a54cd954417f81e (patch) | |
tree | 134fcc3d122442ba2d63710ee4ec148149bc7c0f /index.js | |
parent | ffdfafac1cf298b088be6ec797ea5db61be7137b (diff) |
refactor command line program
- made launching players more consistent
- fixed flush screen bug
- style fixes
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -21,9 +21,10 @@ inherits(WebTorrent, Client) function WebTorrent (opts) { var self = this opts = opts || {} - Client.call(self, opts) + self.listening = false + if (opts.list) { return } @@ -34,6 +35,7 @@ function WebTorrent (opts) { self.server.on('request', self._onRequest.bind(self)) self.server.listen(opts.port) self.server.once('listening', function () { + self.listening = true self.emit('listening') }) } @@ -125,7 +127,6 @@ WebTorrent.prototype.add = function (torrentId, opts, cb) { */ WebTorrent.prototype.destroy = function (cb) { var self = this - var tasks = [ Client.prototype.destroy.bind(self) ] @@ -135,13 +136,13 @@ WebTorrent.prototype.destroy = function (cb) { try { self.server.close(cb) } catch (err) { - cb(null) // ignore error, server was either already closed / not yet listening + // ignore error, server was already closed or not listening + cb(null) } }) } parallel(tasks, cb) - return self } |