Options
All
  • Public
  • Public/Protected
  • All
Menu

soft-promise

Index

References

default

Renames and re-exports SoftPromise

Type aliases

BoxedPromise

BoxedPromise<T>: Promise<[T | null, any]>

Type parameters

  • T

PromiseArg

PromiseArg<T>: ((resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) | PromiseParam<T>

Type parameters

  • T

PromiseParam

PromiseParam<T>: Promise<T> | SoftPromise<T>

Type parameters

  • T

Functions

boxPromise

  • Box results of a promise

    example
    const promise = new Promise((resolve, reject) => {
    setTimeout(() => {
    resolve("Hello");
    }, 1000);
    });
    let [result,error] = boxPromise(promise);

    Type parameters

    • T

    Parameters

    Returns BoxedPromise<T>

softenPromise

  • Soften promise

    example
    const promise = new Promise((resolve, reject) => {
    setTimeout(() => {
    resolve("Hello");
    }, 1000);
    });

    softenPromise(promise);

    Type parameters

    • T

    Parameters

    Returns SoftPromise<T>

softenPromiseWithTimeout

  • Soften promise with timeout

    example
    const promise = new Promise((resolve, reject) => {
    setTimeout(() => {
    resolve("Hello");
    }, 1000);
    });
    softenPromiseWithTimeout(promise, 500);

    Type parameters

    • T

    Parameters

    Returns SoftPromise<T>

Generated using TypeDoc