add server.listen(port, onlistening) shorthand

This commit is contained in:
Feross Aboukhadijeh 2014-06-05 23:40:13 -07:00
parent ba84b812c2
commit 202bfe8385

View File

@ -519,10 +519,14 @@ function Server (opts) {
}
}
Server.prototype.listen = function (port) {
Server.prototype.listen = function (port, onlistening) {
var self = this
var tasks = []
if (onlistening) {
self.once('listening', onlistening)
}
self._httpServer && tasks.push(function (cb) {
self._httpServer.listen(port, cb)
})