UNPKG

@kietpt2003/react-native-core-ui

Version:
53 lines (51 loc) 1.53 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/utils/debounce.ts var debounce_exports = {}; __export(debounce_exports, { default: () => debounce_default }); module.exports = __toCommonJS(debounce_exports); var debounce = (func, delay) => { let timeoutId = null; const debounced = (...args) => { if (timeoutId) { clearTimeout(timeoutId); } timeoutId = setTimeout(() => { func(...args); }, delay); }; debounced.cancel = () => { if (timeoutId) { clearTimeout(timeoutId); timeoutId = null; } }; debounced.flush = () => { if (timeoutId) { clearTimeout(timeoutId); func(); timeoutId = null; } }; return debounced; }; var debounce_default = debounce; //# sourceMappingURL=debounce.js.map