UNPKG

@clayui/shared

Version:
23 lines (21 loc) 481 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.throttle = throttle; /** * SPDX-FileCopyrightText: © 2023 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: BSD-3-Clause */ function throttle(callback, limit) { var waiting = false; return function () { if (!waiting) { callback.apply(void 0, arguments); waiting = true; setTimeout(function () { waiting = false; }, limit); } }; }