const createThrottle = (callback) => {
  let calledInThisTick = false;
  let pendingTask = null;
  function executeTask(callback2) {
    calledInThisTick = true;
    callback2();
    queueMicrotask(() => {
      calledInThisTick = false;
      if (pendingTask !== null) {
        const taskToRun = pendingTask;
        pendingTask = null;
        executeTask(taskToRun);
      }
    });
  }
  return function throttled(...args) {
    if (!calledInThisTick) {
      executeTask(() => callback(...args));
    } else {
      pendingTask = () => callback(...args);
    }
  };
};
export {
  createThrottle
};
//# sourceMappingURL=create-throttle.js.map
