You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
InternshipProject/node_modules/rc-input-number/es/hooks/useFrame.js

23 lines
444 B

import { useRef, useEffect } from 'react';
import raf from "rc-util/es/raf";
/**
* Always trigger latest once when call multiple time
*/
export default (function () {
var idRef = useRef(0);
var cleanUp = function cleanUp() {
raf.cancel(idRef.current);
};
useEffect(function () {
return cleanUp;
}, []);
return function (callback) {
cleanUp();
idRef.current = raf(function () {
callback();
});
};
});