Skip to content

Commit 547e4f9

Browse files
committed
feat($core): optional callback when socket connection is ready under dev.
1 parent 6bf2ceb commit 547e4f9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/@vuepress/core/lib/node/App.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ module.exports = class App {
451451
* @api public
452452
*/
453453

454-
async dev () {
454+
async dev (callback) {
455455
this.isProd = false
456456
this.devProcess = new DevProcess(this)
457457
await this.devProcess.process()
@@ -462,7 +462,7 @@ module.exports = class App {
462462
this.process()
463463
})
464464
.createServer()
465-
.listen()
465+
.listen(callback)
466466
}
467467

468468
/**

packages/@vuepress/core/lib/node/dev/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ module.exports = class DevProcess extends EventEmitter {
250250

251251
listen (callback) {
252252
this.server.listen(this.port, this.host, (err) => {
253-
if (callback) {
253+
if (typeof callback === 'function') {
254254
callback(err)
255255
}
256256
})

0 commit comments

Comments
 (0)