Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Misc/debouncePromise

Index

Functions

Functions

debouncePromise

  • debouncePromise(key: string, promiseCreator: PromiseCreator, limit: number, skipAllButLast?: boolean): Promise<any>
  • Similar to throttleEvent but debounces a promise creating callback. As long as the function gets invoked the promiseCreator will not be executed If the delay of limit milliseconds is passed without the function beeing called, the promiseCreator will be executed and tho the real promise created.

    All resulting .then() functions will receive the result of the last promise request.

    Parameters

    • key: string

      A unique key to define a unique promise group

    • promiseCreator: PromiseCreator

      The function which should only be called after the timeout passed

    • limit: number

      The timeout in milliseconds before the promise should be called

    • Optional skipAllButLast: boolean

      If this is set to true only the last .then() will be executed. Otherwise all .then() methods will be executed, but receive the same result

    Returns Promise<any>

Generated using TypeDoc