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