| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8199784 commit 5ed30da
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,18 +72,18 @@ object. This is useful for inspecting large complicated objects. Defaults to | |||
| 72 | 72 | - `colors` - if `true`, then the output will be styled with ANSI color codes. | |
| 73 | 73 | Defaults to `false`. Colors are customizable, see below. | |
| 74 | 74 | ||
| 75 | - ### console.time(timerName) | ||
| 75 | + ### console.time(label) | ||
| 76 | 76 | ||
| 77 | 77 | Starts a timer that can be used to compute the duration of an operation. Timers | |
| 78 | 78 | are identified by a unique name. Use the same name when you call | |
| 79 | - [`console.timeEnd()`](#console_console_timeend_timername) to stop the timer and | ||
| 79 | + [`console.timeEnd()`](#console_console_timeend_label) to stop the timer and | ||
| 80 | 80 | output the elapsed time in milliseconds. Timer durations are accurate to the | |
| 81 | 81 | sub-millisecond. | |
| 82 | 82 | ||
| 83 | - ### console.timeEnd(timerName) | ||
| 83 | + ### console.timeEnd(label) | ||
| 84 | 84 | ||
| 85 | 85 | Stops a timer that was previously started by calling | |
| 86 | - [`console.time()`](#console_console_time_timername) and prints the result to the | ||
| 86 | + [`console.time()`](#console_console_time_label) and prints the result to the | ||
| 87 | 87 | console. | |
| 88 | 88 | ||
| 89 | 89 | Example: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,19 +55,19 @@ Console.prototype.dir = function(object, options) { | |||
| 55 | 55 | }; | |
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | - Console.prototype.time = function(timerName) { | ||
| 59 | - this._times.set(timerName, process.hrtime()); | ||
| 58 | + Console.prototype.time = function(label) { | ||
| 59 | + this._times.set(label, process.hrtime()); | ||
| 60 | 60 | }; | |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | - Console.prototype.timeEnd = function(timerName) { | ||
| 64 | - var time = this._times.get(timerName); | ||
| 63 | + Console.prototype.timeEnd = function(label) { | ||
| 64 | + var time = this._times.get(label); | ||
| 65 | 65 | if (!time) { | |
| 66 | - throw new Error('No such timer name: ' + timerName); | ||
| 66 | + throw new Error('No such label: ' + label); | ||
| 67 | 67 | } | |
| 68 | 68 | const duration = process.hrtime(time); | |
| 69 | 69 | const ms = duration[0] * 1000 + duration[1] / 1e6; | |
| 70 | - this.log('%s: %sms', timerName, ms.toFixed(3)); | ||
| 70 | + this.log('%s: %sms', label, ms.toFixed(3)); | ||
| 71 | 71 | }; | |
| 72 | 72 | ||
| 73 | 73 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments