UTILS

Methods

(static) debounce($delay) → {TypeDebouncer}

Description:
  • Creates a debouncer.
Source:
Parameters:
Name Type Description
$delay number The delay of the debouncer.
Returns:
Type
TypeDebouncer

(static) deduplicate($array) → {Array.<TypeGeneric>}

Description:
  • Deduplicates the items of the given array (a new array is created).
Source:
Parameters:
Name Type Description
$array Array.<TypeGeneric> The array.
Returns:
Type
Array.<TypeGeneric>

(static) extract($item, $array) → {Array.<TypeGeneric>}

Description:
  • Extracts all occurences of the given item from the given array.
Source:
Parameters:
Name Type Description
$item TypeGeneric The item to remove.
$array Array.<TypeGeneric> The array.
Returns:
Type
Array.<TypeGeneric>

(static) frame() → {Promise.<number>}

Description:
  • Resolves when the browser is ready to perform an animation frame request.
Source:
Returns:
Type
Promise.<number>

(static) ready() → {Promise.<void>}

Description:
  • Resolves when the user has interacted at least once since page load.
Source:
Returns:
Type
Promise.<void>

(static) shuffle($array) → {Array.<TypeGeneric>}

Description:
  • Shuffles the given array ("Fisher–Yates").
Source:
Parameters:
Name Type Description
$array Array.<TypeGeneric> The array to shuffle.
Returns:
Type
Array.<TypeGeneric>

(static) sleep($delay) → {Promise.<void>}

Description:
  • Resolves when the given delay has passed.
Source:
Parameters:
Name Type Description
$delay number The delay (in ms).
Returns:
Type
Promise.<void>

(static) uuid() → {string}

Description:
  • Gets a new UUID.
Source:
Returns:
Type
string

Type Definitions

(protected) TypeDebouncer($handler) → {Promise.<any>}

Source:
Parameters:
Name Type Description
$handler TypeDebouncerHandler The debouncer handler.
Returns:
Type
Promise.<any>

(protected) TypeDebouncerHandler() → {any}

Source:
Returns:
Type
any