|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
920 bytes
|
| Line | |
|---|
| 1 | # browser-process-hrtime
|
|---|
| 2 |
|
|---|
| 3 | Browser shim for Node.js `process.hrtime()`.
|
|---|
| 4 | See [documentation at nodejs.org](http://nodejs.org/api/process.html#process_process_hrtime)
|
|---|
| 5 |
|
|---|
| 6 | This module does not provide the same level of time precision as node.js, but provides a matching API and response format.
|
|---|
| 7 |
|
|---|
| 8 | ### usage
|
|---|
| 9 | Use hrtime independent of environment (node or browser).
|
|---|
| 10 | It will use `process.hrtime` first and fallback if not present.
|
|---|
| 11 | ```js
|
|---|
| 12 | const hrtime = require('browser-process-hrtime')
|
|---|
| 13 | const start = hrtime()
|
|---|
| 14 | // ...
|
|---|
| 15 | const delta = hrtime(start)
|
|---|
| 16 | ```
|
|---|
| 17 |
|
|---|
| 18 | ### monkey-patching
|
|---|
| 19 | You can monkey-patch `process.hrtime` for your dependency graph like this:
|
|---|
| 20 | ```js
|
|---|
| 21 | process.hrtime = require('browser-process-hrtime')
|
|---|
| 22 | const coolTool = require('module-that-uses-hrtime-somewhere-in-its-depths')
|
|---|
| 23 | ```
|
|---|
| 24 |
|
|---|
| 25 | ### note
|
|---|
| 26 | This was originally pull-requested against [node-process](https://github.com/defunctzombie/node-process),
|
|---|
| 27 | but they are trying to stay lean.
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.