disable browser auto-open when webserver first starts, not the `open browser` console cmd
This commit is contained in:
parent
d03cfebbdf
commit
8acab6ef5b
|
@ -22,7 +22,6 @@ class WebServer {
|
|||
|
||||
this.host = this.webServerConfig.host;
|
||||
this.port = parseInt(this.webServerConfig.port, 10);
|
||||
this._openBrowser = this.webServerConfig.openBrowser;
|
||||
|
||||
this.events.emit("status", __("Starting Server"));
|
||||
|
||||
|
@ -30,7 +29,8 @@ class WebServer {
|
|||
buildDir: this.buildDir,
|
||||
events: this.events,
|
||||
host: this.host,
|
||||
port: this.port
|
||||
port: this.port,
|
||||
openBrowser: this.webServerConfig.openBrowser
|
||||
});
|
||||
|
||||
this.events.on('webserver:config:change', () => {
|
||||
|
@ -136,9 +136,6 @@ class WebServer {
|
|||
}
|
||||
|
||||
openBrowser(cb) {
|
||||
if (!this._openBrowser) {
|
||||
return cb();
|
||||
}
|
||||
const _cb = () => { cb(); };
|
||||
return opn(
|
||||
`http://${canonicalHost(this.server.hostname)}:${this.server.port}`,
|
||||
|
|
|
@ -13,6 +13,7 @@ class Server {
|
|||
this.hostname = dockerHostSwap(options.host) || defaultHost;
|
||||
this.isFirstStart = true;
|
||||
this.opened = false;
|
||||
this.openBrowser = options.openBrowser;
|
||||
}
|
||||
|
||||
start(callback) {
|
||||
|
@ -45,7 +46,7 @@ class Server {
|
|||
});
|
||||
},
|
||||
function openBrowser(next) {
|
||||
if (self.opened) {
|
||||
if (!self.openBrowser || self.opened) {
|
||||
return next();
|
||||
}
|
||||
self.opened = true;
|
||||
|
|
Loading…
Reference in New Issue