Skip to content

Commit

Permalink
feat($core): optional callback when socket connection is ready under …
Browse files Browse the repository at this point in the history
…dev.
  • Loading branch information
ulivz committed Mar 10, 2019
1 parent 6bf2ceb commit 547e4f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/@vuepress/core/lib/node/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ module.exports = class App {
* @api public
*/

async dev () {
async dev (callback) {
this.isProd = false
this.devProcess = new DevProcess(this)
await this.devProcess.process()
Expand All @@ -462,7 +462,7 @@ module.exports = class App {
this.process()
})
.createServer()
.listen()
.listen(callback)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@vuepress/core/lib/node/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ module.exports = class DevProcess extends EventEmitter {

listen (callback) {
this.server.listen(this.port, this.host, (err) => {
if (callback) {
if (typeof callback === 'function') {
callback(err)
}
})
Expand Down

0 comments on commit 547e4f9

Please sign in to comment.