decord/alpha/source/modules/vibegrations/lib/useVibegrationsElapsedMs.tsx
github-actions 1224ea86fd chore: update source for alpha 348.5
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-26 08:31:33 +00:00

46 lines
1.4 KiB
TypeScript

// Module ID: 16397
// Function ID: 16398
// Name: useVibegrationsElapsedMs
// Dependencies: [32, 19, 2]
// Exports: useVibegrationsElapsedMs
// Module 16397 (useVibegrationsElapsedMs)
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
let closure_2 = { second: 1000, minute: 60000 };
const size = fn(2);
const result = size.fileFinishedImporting("modules/vibegrations/lib/useVibegrationsElapsedMs.tsx");
export const useVibegrationsElapsedMs = function useVibegrationsElapsedMs(startedAt) {
_slicedToArray = startedAt;
let str = arg1;
if (arg1 === undefined) {
str = "second";
}
const tmp = _slicedToArray(str.useState(() => Date.now()), 2);
closure_2 = tmp[1];
const items = [startedAt, str];
const effect = str.useEffect(() => {
if (null != timeout) {
closure_1 = tmp4;
function tick() {
const timestamp = Date.now();
tick(timestamp);
timeout = setTimeout(tick, closure_1 - ((timestamp - timeout) % closure_1 + closure_1) % closure_1);
}
const _Date = Date;
let timestamp = Date.now();
tick(timestamp);
const _setTimeout = setTimeout;
timeout = setTimeout(tick, tmp4 - ((timestamp - tmp) % tmp4 + tmp4) % tmp4);
return () => clearTimeout(closure_0);
}
}, items);
let bound;
if (null != startedAt) {
const _Math = Math;
bound = Math.max(0, tmp[0] - startedAt);
}
return bound;
};