All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.lib.utils.debounce.js.flow Maven / Gradle / Ivy

There is a newer version: 2.11.8
Show newest version
// @flow

export default function debounce(fn: Function): () => Promise {
  let pending;
  return () => {
    if (!pending) {
      pending = new Promise(resolve => {
        Promise.resolve().then(() => {
          pending = undefined;
          resolve(fn());
        });
      });
    }

    return pending;
  };
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy