Members
-
The types of loading a resource can use.
Properties:
Name Type Default Description XHR
number 1 Uses XMLHttpRequest to load the resource.
IMAGE
number 2 Uses an
Image
object to load the resource.AUDIO
number 3 Uses an
Audio
object to load the resource.VIDEO
number 4 Uses a
Video
object to load the resource. -
The types of resources a resource could represent.
Properties:
Name Type Default Description NONE
number 0 DATA_URL
number COMPLETE
number LOADING
number -
The types of resources a resource could represent.
Properties:
Name Type Default Description UNKNOWN
number 0 JSON
number 1 XML
number 2 IMAGE
number 3 AUDIO
number 4 VIDEO
number 5 TEXT
number 6 -
The XHR ready states, used internally.
Properties:
Name Type Default Description DEFAULT
string text string
BUFFER
string arraybuffer ArrayBuffer
BLOB
string blob Blob
DOCUMENT
string document Document
JSON
string json Object
TEXT
string text String
Methods
-
Sets the load type to be used for a specific extension.
Name Type Description extname
string The extension to set the type for, e.g. "png" or "fnt"
loadType
Resource.LOAD_TYPE The load type to set it to.
-
Sets the load type to be used for a specific extension.
Name Type Description extname
string The extension to set the type for, e.g. "png" or "fnt"
xhrType
Resource.XHR_RESPONSE_TYPE The xhr type to set it to.
Type Definitions
-
Properties:
Name Type Argument Default Description loadElement
HTMLImageElement | HTMLAudioElement | HTMLVideoElement <optional>
null The element to use for loading, instead of creating one.
skipSource
boolean <optional>
false Skips adding source(s) to the load element. This is useful if you want to pass in a
loadElement
that you already added load sources to.mimeType
string | Array.<string> <optional>
The mime type to use for the source element of a video/audio elment. If the urls are an array, you can pass this as an array as well where each index is the mime type to use for the corresponding url index.
-
When the resource finishes loading.
Name Type Description resource
Resource The resource that the event happened on.
-
When the resource reports loading progress.
Name Type Description resource
Resource The resource that the event happened on.
percentage
number The progress of the load in the range [0, 1].
-
When the resource starts to load.
Name Type Description resource
Resource The resource that the event happened on.