79 lines
1.8 KiB
TypeScript
79 lines
1.8 KiB
TypeScript
// Metro module 10863 (f10864).
|
|
import { useRef, useEffect } from "react";
|
|
import { throttle } from "../_bundle/Module12";
|
|
function $mk85665($env) {
|
|
return () => {
|
|
const r1 = $env;
|
|
const r3 = r1[3];
|
|
const r2 = $env.$parent;
|
|
r3.current = (0, r2[0])(r2[1][1]).throttle(r1[0], r1[1], r1[2]);
|
|
return $mk107494(r1);
|
|
};
|
|
}
|
|
function $mk107494($env) {
|
|
return () => {
|
|
const current2 = $env[3].current;
|
|
if (current2 != null) {
|
|
current2.cancel();
|
|
}
|
|
};
|
|
}
|
|
let useThrottledFunction;
|
|
let env7301 = {};
|
|
const throttleStateFn = function throttleStateFn(a0) {
|
|
return a0;
|
|
};
|
|
useThrottledFunction = function useThrottledFunction(a0, a1) {
|
|
let env18319;
|
|
const r3 = env18319 = {
|
|
$parent: env7301
|
|
};
|
|
env18319[0] = a0;
|
|
env18319[1] = a1;
|
|
let r7 = arguments[2];
|
|
if (r7 === void 0) {
|
|
r7 = [];
|
|
}
|
|
const r8 = arguments[3];
|
|
env18319[2] = r8;
|
|
env18319[3] = void 0;
|
|
const ref2 = useRef(throttle(a0, a1, r8));
|
|
env18319[3] = ref2;
|
|
const r21 = [a0, a1, r8, ...r7];
|
|
useEffect($mk85665(r3), r21);
|
|
return ref2.current;
|
|
};
|
|
export const useThrottledState = function(a0, a1) {
|
|
let r2 = a0;
|
|
let r10 = arguments[2];
|
|
if (r10 === void 0) {
|
|
r10 = [];
|
|
}
|
|
let env18321;
|
|
const r6 = env18321 = {
|
|
$parent: env7301
|
|
};
|
|
env18321[0] = throttleStateFn;
|
|
env18321[1] = a1;
|
|
if (r10 === void 0) {
|
|
r10 = [];
|
|
}
|
|
const r11 = arguments[3];
|
|
env18321[2] = r11;
|
|
env18321[3] = void 0;
|
|
const ref2 = useRef(throttle(throttleStateFn, a1, r11));
|
|
env18321[3] = ref2;
|
|
const r25 = [throttleStateFn, a1, r11, ...r10];
|
|
useEffect($mk85665(r6), r25);
|
|
const current = ref2.current;
|
|
const ref = useRef(a0);
|
|
useEffect(() => {
|
|
ref.current = current(a0);
|
|
}, [a0, current]);
|
|
if (a1 !== 0) {
|
|
r2 = ref.current;
|
|
}
|
|
return r2;
|
|
};
|
|
export { useThrottledFunction };
|