@vue/devtools-api 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/time.js +9 -3
- package/lib/esm/time.d.ts +1 -0
- package/lib/esm/time.js +7 -2
- package/package.json +1 -1
package/lib/cjs/time.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.now = void 0;
|
|
3
|
+
exports.now = exports.isPerformanceSupported = void 0;
|
|
4
4
|
let supported;
|
|
5
5
|
let perf;
|
|
6
|
-
function
|
|
6
|
+
function isPerformanceSupported() {
|
|
7
|
+
var _a;
|
|
7
8
|
if (supported !== undefined) {
|
|
8
9
|
return supported;
|
|
9
10
|
}
|
|
@@ -11,12 +12,17 @@ function isSupported() {
|
|
|
11
12
|
supported = true;
|
|
12
13
|
perf = window.performance;
|
|
13
14
|
}
|
|
15
|
+
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
|
16
|
+
supported = true;
|
|
17
|
+
perf = global.perf_hooks.performance;
|
|
18
|
+
}
|
|
14
19
|
else {
|
|
15
20
|
supported = false;
|
|
16
21
|
}
|
|
17
22
|
return supported;
|
|
18
23
|
}
|
|
24
|
+
exports.isPerformanceSupported = isPerformanceSupported;
|
|
19
25
|
function now() {
|
|
20
|
-
return
|
|
26
|
+
return isPerformanceSupported() ? perf.now() : Date.now();
|
|
21
27
|
}
|
|
22
28
|
exports.now = now;
|
package/lib/esm/time.d.ts
CHANGED
package/lib/esm/time.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
let supported;
|
|
2
2
|
let perf;
|
|
3
|
-
function
|
|
3
|
+
export function isPerformanceSupported() {
|
|
4
|
+
var _a;
|
|
4
5
|
if (supported !== undefined) {
|
|
5
6
|
return supported;
|
|
6
7
|
}
|
|
@@ -8,11 +9,15 @@ function isSupported() {
|
|
|
8
9
|
supported = true;
|
|
9
10
|
perf = window.performance;
|
|
10
11
|
}
|
|
12
|
+
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
|
13
|
+
supported = true;
|
|
14
|
+
perf = global.perf_hooks.performance;
|
|
15
|
+
}
|
|
11
16
|
else {
|
|
12
17
|
supported = false;
|
|
13
18
|
}
|
|
14
19
|
return supported;
|
|
15
20
|
}
|
|
16
21
|
export function now() {
|
|
17
|
-
return
|
|
22
|
+
return isPerformanceSupported() ? perf.now() : Date.now();
|
|
18
23
|
}
|