import { __spreadArray } from "tslib";
export default function debounce(func, wait, immediate) {
    var timeout;
    return function () {
        var _this = this;
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        clearTimeout(timeout);
        timeout = setTimeout(function () {
            timeout = null;
            if (!immediate)
                func.apply(_this, args);
        }, wait);
        if (immediate && !timeout)
            func.apply(this, __spreadArray([], args, true));
    };
}
//# sourceMappingURL=debounce.js.map