decord/source/5782_useOnLoad.js
2026-08-25 06:04:03 +00:00

71 lines
2 KiB
JavaScript

// Module ID: 5782
// Function ID: 5783
// Name: useOnLoad
// Dependencies: [5735, 19, 5780]
// Exports: useOnListLoad
// Module 5782 (useOnLoad)
import closure_2 from "_slicedToArray" /* 5735 */;
import noop from "noop" /* 19 */;
const require = arg1;
({ useEffect: c3, useMemo: c4, useRef: c5, useState: closure_6 } = noop);
function useOnLoad(arg0, arg1) {
closure_0 = arg0;
closure_1 = arg1;
closure_2 = callback3(false);
callback2(() => {
let isFirstLayoutComplete = getDataLength.getIsFirstLayoutComplete();
if (isFirstLayoutComplete) {
isFirstLayoutComplete = !ref.current;
}
if (isFirstLayoutComplete) {
ref.current = true;
f78550();
}
});
}
export const useOnListLoad = (getDataLength) => {
let _require = getDataLength;
let f78550 = arg1;
let callback = callback3(Date.now());
[tmp3, closure_3] = callback(callback4(false), 2);
const dataLength = getDataLength.getDataLength();
const tmp = callback3;
const tmp2 = callback(callback4(false), 2);
const requestAnimationFrame = _require(f78550[2]).useUnmountAwareAnimationFrame().requestAnimationFrame;
const items = [dataLength];
requestAnimationFrame(() => {
closure_2.current = Date.now();
}, items);
if (typeof useOnLoad !== "function") {
HermesBuiltin.throwTypeError();
}
_require = getDataLength;
f78550 = () => {
closure_0 = Date.now() - ref.current;
requestAnimationFrame(() => {
closure_0.isFirstPaintOnUiComplete = true;
if (closure_1_1 != null) {
const obj = { elapsedTimeInMs: null };
obj[0] = closure_0;
tmp(obj);
}
closure_1_3(true);
});
};
callback = tmp(false);
callback2(() => {
let isFirstLayoutComplete = getDataLength.getIsFirstLayoutComplete();
if (isFirstLayoutComplete) {
isFirstLayoutComplete = !ref.current;
}
if (isFirstLayoutComplete) {
ref.current = true;
f78550();
}
});
return { isLoaded };
};
export { useOnLoad };