superfly-timeline
Advanced tools
Comparing version 9.0.0-nightly-wip-big-rewrite-20230814-192948-870dbc7.0 to 9.0.0-nightly-wip-big-rewrite-20230818-064242-241b192.0
export declare function activatePerformanceDebugging(activate: boolean): void; | ||
export declare const performance: { | ||
now: (this: void) => number; | ||
}; | ||
/** | ||
* This is a little wierd, but we don't want to import performance from 'perf_hooks' directly, | ||
* because that will cause issues when this library is used in a browser. | ||
* Intended usage: | ||
* import { performance } from 'perf_hooks' | ||
* setPerformanceTimeFunction(performance.now) | ||
* @param now | ||
*/ | ||
export declare function setPerformanceTimeFunction(now: () => number): void; | ||
/** | ||
* Used to measure performance. | ||
@@ -4,0 +16,0 @@ * Starts a measurement, returns a function that should be called when the measurement is done. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ticTocPrint = exports.tic = exports.activatePerformanceDebugging = void 0; | ||
const perf_hooks_1 = require("perf_hooks"); | ||
exports.ticTocPrint = exports.tic = exports.setPerformanceTimeFunction = exports.performance = exports.activatePerformanceDebugging = void 0; | ||
let durations = {}; | ||
@@ -13,2 +12,17 @@ let callCounts = {}; | ||
exports.activatePerformanceDebugging = activatePerformanceDebugging; | ||
exports.performance = { | ||
now: Date.now, | ||
}; | ||
/** | ||
* This is a little wierd, but we don't want to import performance from 'perf_hooks' directly, | ||
* because that will cause issues when this library is used in a browser. | ||
* Intended usage: | ||
* import { performance } from 'perf_hooks' | ||
* setPerformanceTimeFunction(performance.now) | ||
* @param now | ||
*/ | ||
function setPerformanceTimeFunction(now) { | ||
exports.performance.now = now; | ||
} | ||
exports.setPerformanceTimeFunction = setPerformanceTimeFunction; | ||
function noop() { | ||
@@ -25,3 +39,3 @@ // nothing | ||
if (!firstStartTime) | ||
firstStartTime = perf_hooks_1.performance.now(); | ||
firstStartTime = exports.performance.now(); | ||
if (!durations[id]) | ||
@@ -31,5 +45,5 @@ durations[id] = 0; | ||
callCounts[id] = 0; | ||
const startTime = perf_hooks_1.performance.now(); | ||
const startTime = exports.performance.now(); | ||
return () => { | ||
const duration = perf_hooks_1.performance.now() - startTime; | ||
const duration = exports.performance.now() - startTime; | ||
durations[id] = durations[id] + duration; | ||
@@ -43,3 +57,3 @@ callCounts[id]++; | ||
return; | ||
const totalDuration = perf_hooks_1.performance.now() - firstStartTime; | ||
const totalDuration = exports.performance.now() - firstStartTime; | ||
const maxKeyLength = Math.max(...Object.keys(durations).map((k) => k.length)); | ||
@@ -46,0 +60,0 @@ console.log('ticTocPrint\n' + |
{ | ||
"name": "superfly-timeline", | ||
"version": "9.0.0-nightly-wip-big-rewrite-20230814-192948-870dbc7.0", | ||
"version": "9.0.0-nightly-wip-big-rewrite-20230818-064242-241b192.0", | ||
"description": "A collection of rules as well as a resolver for placing objects on a virtual timeline.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
414775
4487
0