mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 14:34:40 +00:00
best practice re: early return w/ callback invocation
This commit is contained in:
parent
c02199db0f
commit
b67aa8cc2d
@ -32,11 +32,11 @@ class Server {
|
||||
|
||||
async.waterfall([
|
||||
function createPlaceholderPage(next) {
|
||||
if (self.isFirstStart) {
|
||||
self.isFirstStart = false;
|
||||
return self.events.request('build-placeholder', next);
|
||||
if (!self.isFirstStart) {
|
||||
return next();
|
||||
}
|
||||
next();
|
||||
self.isFirstStart = false;
|
||||
self.events.request('build-placeholder', next);
|
||||
},
|
||||
function listen(next) {
|
||||
self.server.listen(self.port, self.hostname, () => {
|
||||
@ -45,12 +45,9 @@ class Server {
|
||||
});
|
||||
},
|
||||
function openBrowser(next) {
|
||||
if (!self.opened) {
|
||||
self.opened = true;
|
||||
return self.events.request('open-browser', next);
|
||||
if (self.opened) {
|
||||
return next();
|
||||
}
|
||||
next();
|
||||
},
|
||||
function reportAvailable(next) {
|
||||
next(null, __("webserver available at") +
|
||||
" " +
|
||||
|
@ -29,11 +29,11 @@ class Pipeline {
|
||||
|
||||
async.waterfall([
|
||||
function createPlaceholderPage(next){
|
||||
if (!self.isFirstBuild) {
|
||||
return self.events.request('build-placeholder', next);
|
||||
}
|
||||
if (self.isFirstBuild) {
|
||||
self.isFirstBuild = false;
|
||||
next();
|
||||
return next();
|
||||
}
|
||||
self.events.request('build-placeholder', next);
|
||||
},
|
||||
function buildTheContracts(next) {
|
||||
self.buildContracts(next);
|
||||
|
Loading…
x
Reference in New Issue
Block a user