browser-hrtime
browser support for process.hrtime()
.
📦 Installation
npm
npm install browser-hrtime
yarn
yarn add browser-hrtime
📃 Examples
NodeJS
As a polyfill
; const time = process;// [ 1800216, 25 ];
As a function
const hrtime = ; const time = ;// [ 1800216, 25 ];
TypeScript
Add "esModuleInterop": true
to tsconfig.json
or use:
;
Web with module
; const time = ;// [ 1800216, 25 ];
or as polyfill:
;const time = process;// [ 1800216, 25 ] ;
Usage as an Angular polyfill:
add to src/polyfills.ts
:
import 'browser-hrtime';
Add @types/node to your Angular app
npm i -S @types/node
Then in tsconfig.json
"angularCompilerOptions":
Web
<!-- Or from CDN: --><!-- <script crossorigin src="https://unpkg.com/browser-hrtime/lib/hrtime.js"></script> -->
console; const first = process; console; console;
see NodeJS documenation for detailed process.hrtime API
Contribution
Clone project from Github
git clone git@github.com:cabinjs/browser-hrtime.git
Install npm packages
cd browser-hrtimenpm install
Build sources:
npm run build
Run tests:
npm run test