diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-08-06 18:37:32 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-08-08 18:35:26 -0700 |
commit | 51380bf39936e0bcb1cb671bb20e961e1bb18e7d (patch) | |
tree | 3bed337aa9d2f63fe497f5e2ea826dd499b4b00b /js/console.ts | |
parent | 4a1ccdeadb44983b8966c4623f10c5a665a39517 (diff) |
Organize libdeno functions.
Diffstat (limited to 'js/console.ts')
-rw-r--r-- | js/console.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/js/console.ts b/js/console.ts index 1ec727f14..48ecc6e7e 100644 --- a/js/console.ts +++ b/js/console.ts @@ -97,10 +97,14 @@ function stringifyArgs(args: any[]): string { return out.join(" "); } +type PrintFunc = (x: string) => void; + export class Console { + constructor(private printFunc: PrintFunc) {} + // tslint:disable-next-line:no-any log(...args: any[]): void { - deno.print(stringifyArgs(args)); + this.printFunc(stringifyArgs(args)); } debug = this.log; @@ -108,7 +112,7 @@ export class Console { // tslint:disable-next-line:no-any warn(...args: any[]): void { - deno.print(`ERROR: ${stringifyArgs(args)}`); + this.printFunc(`ERROR: ${stringifyArgs(args)}`); } error = this.warn; |