source: imaps-frontend/node_modules/react-use/lib/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: 800 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var react_1 = require("react");
4var set_harmonic_interval_1 = require("set-harmonic-interval");
5var useHarmonicIntervalFn = function (fn, delay) {
6 if (delay === void 0) { delay = 0; }
7 var latestCallback = react_1.useRef(function () { });
8 react_1.useEffect(function () {
9 latestCallback.current = fn;
10 });
11 react_1.useEffect(function () {
12 if (delay !== null) {
13 var interval_1 = set_harmonic_interval_1.setHarmonicInterval(function () { return latestCallback.current(); }, delay);
14 return function () { return set_harmonic_interval_1.clearHarmonicInterval(interval_1); };
15 }
16 return undefined;
17 }, [delay]);
18};
19exports.default = useHarmonicIntervalFn;
Note: See TracBrowser for help on using the repository browser.