diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2018-10-01 09:41:37 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-01 12:41:37 -0400 |
commit | 3a6d4e62603a711a9ae3e0fa30fd4fd039169de1 (patch) | |
tree | 045a3bf984f9d3f38b02df2fd335b551939aa05f /js/console.ts | |
parent | 1fcc11a19d4522851870eec79ca17233a353cb9e (diff) |
Bind `this` to console methods (#873)
Fixes #872
Diffstat (limited to 'js/console.ts')
-rw-r--r-- | js/console.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/js/console.ts b/js/console.ts index 51798d79d..43d516312 100644 --- a/js/console.ts +++ b/js/console.ts @@ -181,29 +181,29 @@ export class Console { constructor(private printFunc: PrintFunc) {} // tslint:disable-next-line:no-any - log(...args: any[]): void { + log = (...args: any[]): void => { this.printFunc(stringifyArgs(args)); - } + }; debug = this.log; info = this.log; // tslint:disable-next-line:no-any - dir(obj: any, options: ConsoleOptions = {}) { + dir = (obj: any, options: ConsoleOptions = {}) => { this.printFunc(stringifyArgs([obj], options)); - } + }; // tslint:disable-next-line:no-any - warn(...args: any[]): void { + warn = (...args: any[]): void => { this.printFunc(stringifyArgs(args), true); - } + }; error = this.warn; // tslint:disable-next-line:no-any - assert(condition: boolean, ...args: any[]): void { + assert = (condition: boolean, ...args: any[]): void => { if (!condition) { throw new Error(`Assertion failed: ${stringifyArgs(args)}`); } - } + }; } |