Asaps

This class has a set of helper methods to handle Asaps:

now<T>

this method resolves a passed value as an Asap synchronously

Input

value

Type: Trequired

the callback to invoke

Returns

Asap<T>

fromPromise<T>

this method creates an Asap from a Promise

Input

promise

Type: Promise<T>required

the Promise to create the Asap from

name

Type: string optional

name use mainly for logging purposes

Returns

Asap<T>

delay

‌this method creates a delayed asynchronous Asap from a the value and timeout provided

Input

​Title

value

Type: T | IProducer<T>required

the value to create the Asap from

ms

Type: numberrequired

the delay in milliseconds

name

Type: string optional

name use mainly for logging purposes

Returns

​Title

Asap<T>

​Content

fetch<T>

‌this method performs a fetch from the given url, and it wraps it up in an Asap

Input

​Title

url

Type: string required

the url to fetch

Returns

​Title

Asap<T>

​Content

next<T>

‌this method lets you create a promise that will be resolved synchronously

Input

​Title

name

Type: string optional

name use mainly for logging purposes

nature

Type: FlowEventNature optional

custom log nature

Returns

​Title

[IConsumer<T>, Asap<T>]

​The Asap returned can be resolved

Last updated