UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

25 lines (24 loc) 914 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.debounce = void 0; const assert_1 = require("../assert"); const debounce_1 = require("../debounce"); const defineFunctionName_1 = require("../functional/defineFunctionName"); /** * concurrency simply debounce function * * it will create a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked * * @since 5.18.0 * @category Async * * @param runner * @param wait wait milliseconds before last time invocation */ function debounce(runner, wait) { (0, assert_1.mustProvide)(runner, "runner", "function"); (0, assert_1.mustProvide)(wait, "wait", "number"); return (0, defineFunctionName_1.defineFunctionName)((0, debounce_1.debounce)(runner, wait), runner?.name); } exports.debounce = debounce; exports.default = debounce;