Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Use the built-in performance module
Browse files Browse the repository at this point in the history
Cherry-pick 32b90a8
  • Loading branch information
Antoine-C authored and kevinvanrijn committed Sep 24, 2024
1 parent fdb61db commit 92c8321
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@
"json-stringify-safe": "~5.0.1",
"mime-types": "^2.1.35",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.3",
"safe-buffer": "^5.1.2",
"stream-length": "^1.0.2",
"uuid": "^8.3.2"
},
"optionalDependencies": {
"performance-now": "^2.1.0"
},
"scripts": {
"test": "npm run lint && npm run test-ci && npm run test-browser",
"test-ci": "taper tests/test-*.js",
Expand Down
6 changes: 5 additions & 1 deletion request.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ var hawk = require('./lib/hawk')
var Multipart = require('./lib/multipart').Multipart
var Redirect = require('./lib/redirect').Redirect
var Tunnel = require('./lib/tunnel').Tunnel
var now = require('performance-now')
try {
var now = require('performance-now')
} catch (e) {
now = require('perf_hooks').performance.now
}
var Buffer = require('safe-buffer').Buffer
var inflate = require('./lib/inflate')
var brotli = require('./lib/brotli')
Expand Down

0 comments on commit 92c8321

Please sign in to comment.