Skip to content

Commit

Permalink
fix(hukk): not display default log when listen has callback
Browse files Browse the repository at this point in the history
this will allow the consumer controll on their own end
  • Loading branch information
nampdn committed Nov 22, 2018
1 parent 7aa7c29 commit d25feaa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/hukk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export class Hukk {
listen(port: number, callback?: () => void) {
this.port = port || Hukk.DEFAULT_PORT;
this.server.listen(this.port, 'localhost', () => {
this._onStart();
callback && callback();
this._onStart(callback);
});
}

Expand All @@ -37,8 +36,11 @@ export class Hukk {
}
}

private _onStart() {
console.log(`Hukk is running on http://localhost:${this.port}`);
private _onStart(callback?: () => void) {
callback && callback();
if (!callback) {
console.log(`Hukk is running on http://localhost:${this.port}`);
}
}

private _handleRequest(req: IncomingMessage, res: ServerResponse) {
Expand Down

0 comments on commit d25feaa

Please sign in to comment.