diff options
| author | Yash Ladha <yashladhapankajladha123@gmail.com> | 2021-03-16 22:15:02 +0530 |
|---|---|---|
| committer | James M Snell <jasnell@gmail.com> | 2021-04-30 13:28:27 -0700 |
| commit | 93f0b4d35bf72a1119b8a5bfea932b85faa1a4a6 (patch) | |
| tree | b50d379518b06a75ddaef611d347e17a1b9fe02e /doc/api/perf_hooks.md | |
| parent | 5bfb6f0564403093c03c30112763e5fa1bb24df5 (diff) | |
| download | node-new-93f0b4d35bf72a1119b8a5bfea932b85faa1a4a6.tar.gz | |
perf_hooks: add toJSON to performance class
Added toJSON method to the InternalPerformance class as per the
convention followed in other performance classes and per the spec:
https://www.w3.org/TR/hr-time/#tojson-method
Fixes: https://github.com/nodejs/node/issues/37623
PR-URL: https://github.com/nodejs/node/pull/37771
Fixes: https://github.com/nodejs/node/issues/37623
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/perf_hooks.md')
| -rw-r--r-- | doc/api/perf_hooks.md | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index 11795b98dc..3609ddfc04 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -261,6 +261,14 @@ If the wrapped function returns a promise, a finally handler will be attached to the promise and the duration will be reported once the finally handler is invoked. +### `performance.toJSON()` +<!-- YAML +added: REPLACEME +--> + +An object which is JSON representation of the `performance` object. It +is similar to [`window.performance.toJSON`][] in browsers. + ## Class: `PerformanceEntry` <!-- YAML added: v8.5.0 @@ -1025,4 +1033,5 @@ require('some-module'); [`child_process.spawnSync()`]: child_process.md#child_process_child_process_spawnsync_command_args_options [`process.hrtime()`]: process.md#process_process_hrtime_time [`timeOrigin`]: https://w3c.github.io/hr-time/#dom-performance-timeorigin +[`window.performance.toJSON`]: https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON [`window.performance`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/performance |
