Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Callbacks

Index

Functions

All

  • All<T>(callbacks: function[], callback: MqlCallback<T[]>): void

AsAsync

  • AsAsync<R>(fn: function): function
  • Type parameters

    • R

    Parameters

    • fn: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns function

      • (...args: any[]): Promise<R>
      • Parameters

        • Rest ...args: any[]

        Returns Promise<R>

AsCallback

  • AsCallback<R>(promise: Promise<R>): function

Chain

  • Chain<T>(callback: function, fn: function, cb: MqlCallback<T>): void

Map

Reduce

  • Reduce<T, A>(callbacks: function[], fn: function, cb: MqlCallback<A>): void
  • Type parameters

    • T

    • A

    Parameters

    • callbacks: function[]
    • fn: function
        • (next: T[]): A
        • Parameters

          • next: T[]

          Returns A

    • cb: MqlCallback<A>

    Returns void

Trap

  • Trap<T>(f: function): function
  • Given a callback lambda, returns the same lambda wrapped in a Try/Catch.

    The Try/Catch can help with catching synchronous errors, which would otherwise be uncaught by the framework.

    export
    template

    T The return type of the callback

    Type parameters

    • T

    Parameters

    Returns function

    A lambda that will plumb errors to the callback

TrapAsResult

  • TrapAsResult<T>(f: function): function
  • Like [Trap], but this will plumb errors as Results instead.

    This is useful if you want to share the Error as a meaningful result (for instance, cell-level errors in queries).

    Any errors are asserted as Errors- that is, if the value in a catch or error callback isn't an instance of an error, it will be wrapped in one. This may lead to misleading stack traces, though. It's always better to use real Errors instead of throw-by-value.

    export
    template

    T The return type of the callback

    Type parameters

    • T

    Parameters

    Returns function

    A wrapped lambda that will never throw or use the error callback

Generated using TypeDoc