Adds the ability to measure requests using the Performance Timings API.
Uses the Performance API
(browsers &
node.js) to expose timings related to
the underlying request.
Browser timings are very accurate, node.js only contains raw measures.
importPerfsAddonfrom"wretch/addons/perfs"
// Use perfs() before the response types (text, json, ...) wretch("...") .addon(PerfsAddon()) .get() .perfs((timings) => { // Will be called when the timings are ready. console.log(timings.startTime); }) .res();
For node.js, there is a little extra work to do :
// Node.js only const { performance, PerformanceObserver } = require("perf_hooks");
Adds the ability to measure requests using the Performance Timings API.
Uses the Performance API (browsers & node.js) to expose timings related to the underlying request.
Browser timings are very accurate, node.js only contains raw measures.
For node.js, there is a little extra work to do :