source: imaps-frontend/node_modules/react-use/esm/useHarmonicIntervalFn.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 679 bytes
RevLine 
[d565449]1import { useEffect, useRef } from 'react';
2import { clearHarmonicInterval, setHarmonicInterval } from 'set-harmonic-interval';
3var useHarmonicIntervalFn = function (fn, delay) {
4 if (delay === void 0) { delay = 0; }
5 var latestCallback = useRef(function () { });
6 useEffect(function () {
7 latestCallback.current = fn;
8 });
9 useEffect(function () {
10 if (delay !== null) {
11 var interval_1 = setHarmonicInterval(function () { return latestCallback.current(); }, delay);
12 return function () { return clearHarmonicInterval(interval_1); };
13 }
14 return undefined;
15 }, [delay]);
16};
17export default useHarmonicIntervalFn;
Note: See TracBrowser for help on using the repository browser.