Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SigaaPromiseStack<K, T>

Class to control promise order Performs chain functions and waits for each promise that the functions return.

Type parameters

  • K

  • T

Hierarchy

  • SigaaPromiseStack

Implements

Index

Constructors

constructor

Properties

Private order

order: PromiseStackOrder

Order type. If it is reverse, the last entered will be the first executed. default is normal.

Private Optional promiseRunning

promiseRunning: PromiseItemStack<K, T>

Current promise running object as {key, promiseFunction, promise}.

Private storedPromises

storedPromises: PromiseItemStack<K, T>[] = []

store all promises objects as {key, promiseFunction, promise}

Accessors

promises

Methods

addPromise

  • Add promise in stack. The function is not called the moment it is added to the stack, but when it is your turn on the stack

    Parameters

    • key: K

      Key of promise array, to identify a function.

    • promiseFunction: FunctionPromise<T>

      function to generate the promise

    Returns Promise<T>

    A promise that resolves with the function's response.

flush

  • flush(): void

Private promiseExecutor

  • promiseExecutor(): Promise<void>

Generated using TypeDoc