Class: shaka.util.Functional

A set of functional utility functions.

Constructor

new Functional()

A set of functional utility functions.

Source:

Methods

delay(seconds) → {Promise}

Returns a Promise which is resolved after the given number of seconds.
Parameters:
Name Type Description
seconds number
Source:
Returns:
Type
Promise

isNotNull(value) → {boolean}

Returns if the given value is not null; useful for filtering out null values.
Parameters:
Name Type Description
value T
Source:
Returns:
Type
boolean

promiseWithTimeout(seconds, asyncProcessnon-null) → {Promise<T>}

Returns a Promise which is resolved only if |asyncProcess| is resolved, and only if it is resolved in less than |seconds| seconds. If the returned Promise is resolved, it returns the same value as |asyncProcess|. If |asyncProcess| fails, the returned Promise is rejected. If |asyncProcess| takes too long, the returned Promise is rejected, but |asyncProcess| is still allowed to complete.
Parameters:
Name Type Description
seconds number
asyncProcess Promise<T>
Source:
Returns:
Type
Promise<T>