mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-19 04:31:36 +00:00
add server.listen(port, onlistening) shorthand
This commit is contained in:
parent
ba84b812c2
commit
202bfe8385
6
index.js
6
index.js
@ -519,10 +519,14 @@ function Server (opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Server.prototype.listen = function (port) {
|
Server.prototype.listen = function (port, onlistening) {
|
||||||
var self = this
|
var self = this
|
||||||
var tasks = []
|
var tasks = []
|
||||||
|
|
||||||
|
if (onlistening) {
|
||||||
|
self.once('listening', onlistening)
|
||||||
|
}
|
||||||
|
|
||||||
self._httpServer && tasks.push(function (cb) {
|
self._httpServer && tasks.push(function (cb) {
|
||||||
self._httpServer.listen(port, cb)
|
self._httpServer.listen(port, cb)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user