Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
// Module ID: 10906
|
|
// Function ID: 10907
|
|
// Dependencies: [19]
|
|
// Exports: useAutoPlay
|
|
|
|
// Module 10906
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
|
|
export const useAutoPlay = function useAutoPlay(autoPlay) {
|
|
autoPlay = autoPlay.autoPlay;
|
|
closure_0 = tmp;
|
|
const autoPlayReverse = autoPlay.autoPlayReverse;
|
|
closure_1 = tmp2;
|
|
const autoPlayInterval = autoPlay.autoPlayInterval;
|
|
const prev = iter.prev;
|
|
const next = iter.next;
|
|
noop.useRef();
|
|
noop.useRef(!(undefined !== autoPlay && autoPlay));
|
|
const items = [undefined !== autoPlayReverse && autoPlayReverse, autoPlayInterval, prev, next];
|
|
const callback = noop.useCallback(() => {
|
|
if (!ref2.current) {
|
|
if (ref.current) {
|
|
const _clearTimeout = clearTimeout;
|
|
clearTimeout(tmp.current);
|
|
}
|
|
const _setTimeout = setTimeout;
|
|
ref.current = setTimeout(() => {
|
|
if (closure_1_1) {
|
|
const obj2 = { onFinished };
|
|
prev(obj2);
|
|
} else {
|
|
const obj = { onFinished };
|
|
next(obj);
|
|
}
|
|
}, autoPlayInterval);
|
|
}
|
|
}, items);
|
|
const items1 = [undefined !== autoPlay && autoPlay];
|
|
const pause = noop.useCallback(() => {
|
|
if (closure_0) {
|
|
if (ref.current) {
|
|
const _clearTimeout = clearTimeout;
|
|
clearTimeout(tmp.current);
|
|
}
|
|
closure_6.current = true;
|
|
}
|
|
}, items1);
|
|
const items2 = [callback, undefined !== autoPlay && autoPlay];
|
|
const start = noop.useCallback(() => {
|
|
if (closure_0) {
|
|
closure_6.current = false;
|
|
callback();
|
|
}
|
|
}, items2);
|
|
const items3 = [pause, start, undefined !== autoPlay && autoPlay];
|
|
const effect = noop.useEffect(() => {
|
|
if (closure_0) {
|
|
start();
|
|
} else {
|
|
pause();
|
|
}
|
|
return pause;
|
|
}, items3);
|
|
return { pause, start };
|
|
};
|