Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "function/defer"

Index

Functions

Functions

defer

  • defer<T>(callback?: function): Promise<T>

  • Example usage:

    import { defer } from "@thalesrc/js-utils/function";
    
    defer(() => aFunctionToDefer())
     .then(res => ...)
     .catch(err => ...);

    Example as promise static method

    import "@thalesrc/js-utils/function/static/defer";
    
    Function.defer(() => aFunctionToDefer())
     .then(res => ...)
     .catch(err => ...);

    Type parameters

    • T

      type of the return value of the callback

    Parameters

    • Default value callback: function = noop as () => T

      Callback function to be executed

        • (): T
        • Returns T

    Returns Promise<T>

    A promise which resolves with the value of the callback right after the execution

Generated using TypeDoc