Skip to content

Commit

Permalink
docs(web-multi-logger): add doc comments for js API site
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed May 15, 2018
1 parent 70801f6 commit a79931f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/utils/web-multi-logger/src/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,28 @@ export default class Logger {
(this.app as any).ws('/sub', () => {});
}

/**
* Creates a new tab with the given name, the name should be human readable
* it will be used as the tab title in the front end.
*/
createTab(name: string) {
const tab = new Tab(name, this.ws);
this.tabs.push(tab);
return tab;
}

/**
* Start the HTTP server hosting the web UI
*/
start() {
return new Promise<number>((resolve) => {
this.server = this.app.listen(this.port, () => resolve(this.port));
});
}

/**
* Stop the HTTP server hosting the web UI
*/
stop() {
if (this.server) this.server.close();
}
Expand Down
3 changes: 3 additions & 0 deletions packages/utils/web-multi-logger/src/Tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export default class Tab {
idCounter += 1;
}

/**
* Log a line to the web UI, a new line is automatically appended to the line
*/
log(line: string) {
const log = new Log(line, new Date());
this.logs.push(log);
Expand Down

0 comments on commit a79931f

Please sign in to comment.