You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
846 B

4 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.now = exports.isPerformanceSupported = void 0;
  4. let supported;
  5. let perf;
  6. function isPerformanceSupported() {
  7. var _a;
  8. if (supported !== undefined) {
  9. return supported;
  10. }
  11. if (typeof window !== 'undefined' && window.performance) {
  12. supported = true;
  13. perf = window.performance;
  14. }
  15. else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
  16. supported = true;
  17. perf = globalThis.perf_hooks.performance;
  18. }
  19. else {
  20. supported = false;
  21. }
  22. return supported;
  23. }
  24. exports.isPerformanceSupported = isPerformanceSupported;
  25. function now() {
  26. return isPerformanceSupported() ? perf.now() : Date.now();
  27. }
  28. exports.now = now;