Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2014-07-29 12:09:55 +0400
committerFeross Aboukhadijeh <feross@feross.org>2014-07-29 12:09:55 +0400
commita1ba43c6598c392e35c029a11a54cd954417f81e (patch)
tree134fcc3d122442ba2d63710ee4ec148149bc7c0f /index.js
parentffdfafac1cf298b088be6ec797ea5db61be7137b (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.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/index.js b/index.js
index df4fd3c..32efcda 100644
--- a/index.js
+++ b/index.js
@@ -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
}