Function createDebouncedEffect

  • Creates an Effect - A higher-order wrapper around a Promise-or-Observable returning function. The effect is debounced for msec, meaning a new invocation waits to being, and interrupts any existing delay or execution. The effect is cancelable if it returns an Observable. createDebouncedEffect runs in concurrency mode: "switching". Note: not only will the debounce interval be canceled upon a new request, cancelation will extend to the underlying effect as well, for example canceling a fetch - provided the EffectSource returned an Observable.

    Parameters

    • msec: number

    Returns (<Request, Response>(handler) => EffectRunner<Request, Response, Error>)

      • <Request, Response>(handler): EffectRunner<Request, Response, Error>
      • Type Parameters

        • Request

        • Response = void

        Parameters

        • handler: EffectSource<Request, Response>

        Returns EffectRunner<Request, Response, Error>

    Example

    `const search = createDebouncedEffect(300)(term => fetch(url + term))`
    

    Summary

    switching mode

Generated using TypeDoc