Skip to content

Commit 202bfe8

Browse files
committed
add server.listen(port, onlistening) shorthand
1 parent ba84b81 commit 202bfe8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,14 @@ function Server (opts) {
519519
}
520520
}
521521

522-
Server.prototype.listen = function (port) {
522+
Server.prototype.listen = function (port, onlistening) {
523523
var self = this
524524
var tasks = []
525525

526+
if (onlistening) {
527+
self.once('listening', onlistening)
528+
}
529+
526530
self._httpServer && tasks.push(function (cb) {
527531
self._httpServer.listen(port, cb)
528532
})

0 commit comments

Comments
 (0)