UNPKG

@appwarden/middleware

Version:

Instantly disable all user interaction with your app deployed on Cloudflare or Vercel

12 lines (10 loc) 371 B
// src/utils/get-now.ts var getNowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now(); var getElapsedMs = (startTime) => Math.round(getNowMs() - startTime); var logElapsed = (debug, startTime) => { debug(`Middleware executed in ${getElapsedMs(startTime)}ms`); }; export { getNowMs, logElapsed };