"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var useAsyncEffect_1 = require("./useAsyncEffect");
var useEffect = React.useEffect, useState = React.useState;
function useIntervalEffect(fn, intervalMS) {
    var _a = useState(0), ticker = _a[0], setTicker = _a[1];
    useEffect(function () {
        var interval = setInterval(function () { return setTicker(ticker + 1); }, intervalMS);
        return function cleanup() {
            clearInterval(interval);
        };
    });
    useAsyncEffect_1.useAsyncEffect(fn, [ticker]);
}
exports.useIntervalEffect = useIntervalEffect;
//# sourceMappingURL=useIntervalEffect.js.map