Class: Preloader

Preloader


new Preloader()

Preloads a list of image, video, and audio files

Author:
  • Chris Peters
Source:

Methods


<static> _isAudio(path)

Returns if file has audio extension

Parameters:
Name Type Description
path String

The file path

Source:
Returns:
Type
Boolean

<static> _isImage(path)

Returns if file has image extension

Parameters:
Name Type Description
path String

The file path

Source:
Returns:
Type
Boolean

<static> _isVideo(path)

Returns if file has video extension

Parameters:
Name Type Description
path String

The file path

Source:
Returns:
Type
Boolean

<static> error(e)

Handles errors

Parameters:
Name Type Description
e Object

The event object

Source:

<static> handleLoad(e)

Increments loaded count and calls complete or update based on count

Parameters:
Name Type Description
e Object

The event object

Source:

<static> load(paths)

Parses file types and preloads them via element tags

Parameters:
Name Type Description
paths String | Array

File paths to preload

Source:

<static> removeListener(el)

Removes event listener when loaded or errored

Parameters:
Name Type Description
el HTMLEntity

The html element

Source:

<static> update(loaded, total)

Callback executed every time an asset has loaded. It gets passed loaded & total
which is useful for displaying percentage feedback.

Parameters:
Name Type Description
loaded Integer
total Integer
Source: