Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PromiseUtils

Utils to help to work with Promise objects.

Hierarchy

  • PromiseUtils

Index

Methods

Static create

  • create(value: any): any
  • Creates a new promise with resolved value used for lazy relations.

    Parameters

    • value: any

    Returns any

Static extractValue

  • extractValue(object: any): any
  • If given value is a promise created by "create" method this method gets its value. If given value is not a promise then given value is returned back.

    Parameters

    • object: any

    Returns any

Static runInSequence

  • runInSequence<T, U>(collection: T[], callback: function): Promise<U[]>
  • Runs given callback that returns promise for each item in the given collection in order. Operations executed after each other, right after previous promise being resolved.

    Type parameters

    • T

    • U

    Parameters

    • collection: T[]
    • callback: function
        • (item: T): Promise<U>
        • Parameters

          • item: T

          Returns Promise<U>

    Returns Promise<U[]>

Static settle

  • settle(promises: Promise<any>[]): any
  • Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected.

    Parameters

    • promises: Promise<any>[]

    Returns any

Generated using TypeDoc