PIXI.LoaderResource

class LoaderResource

Manages the state and loading of a resource and all child resources.

Can be extended in GlobalMixins.LoaderResource.

Constructor


new PIXI.LoaderResource(name: string, url: string | Array<string>, options: object) → {}
Parameters:
Name Type Attributes Default Description
name string

The name of the resource to load.

url string | Array<string>

The url for this resource, for audio/video loads you can pass an array of sources.

options object

<optional>

The options for the load.

options.crossOrigin string | boolean

<optional>

Is this request cross-origin? Default is to determine automatically.

options.timeout number

<optional>

0

A timeout in milliseconds for the load. If the load takes longer than this time it is cancelled and the load is considered a failure. If this value is set to 0 then there is no explicit timeout.

options.loadType PIXI.LoaderResource.LOAD_TYPE

<optional>

LOAD_TYPE.XHR

How should this resource be loaded?

options.xhrType PIXI.LoaderResource.XHR_RESPONSE_TYPE

<optional>

XHR_RESPONSE_TYPE.DEFAULT

How should the data being loaded be interpreted when using XHR?

options.metadata PIXI.LoaderResource.IMetadata

<optional>

Extra configuration for middleware and the Resource object.

Summary


Properties from LoaderResource

Blob
blob

used by parsing middleware

Array<PIXI.LoaderResource>
children
string | boolean
crossOrigin

Is this request cross-origin? If unset, determined automatically.

any
data

The data that was loaded by the resource.

Error
error
string
extension
boolean
isComplete
boolean
isDataUrl
boolean
isLoading
PIXI.LoaderResource.LOAD_TYPE
loadType
PIXI.IResourceMetadata
metadata

Extra info for middleware, and controlling specifics about how the resource loads.

string
name
PIXI.Signal
onAfterMiddleware

Dispatched after this resource has had all the after middleware run on it.

PIXI.Signal
onComplete
PIXI.Signal
onProgress
PIXI.Signal
onStart

Dispatched when the resource beings to load.

number
progressChunk
PIXI.Spritesheet
spritesheet
PIXI.Texture
texture
Object<string, PIXI.Texture>
textures
number
timeout
PIXI.LoaderResource.TYPE
type
string
url
XMLHttpRequest
xhr
string
xhrType

Public Properties


blob LoaderResource.ts:100
blob: Blob

used by parsing middleware

children LoaderResource.ts:165
children: Array<PIXI.LoaderResource>

The child resources this resource owns.

crossOrigin LoaderResource.ts:123
crossOrigin: string | boolean

Is this request cross-origin? If unset, determined automatically.

data LoaderResource.ts:121
data: any

The data that was loaded by the resource.

error LoaderResource.ts:151
error: Error

The error that occurred while loading (if any).

extension LoaderResource.ts:115
extension: string

The extension used to load this resource.

isComplete LoaderResource.ts:456
isComplete: boolean

Describes if this resource has finished loading. Is true when the resource has completely loaded.

isDataUrl LoaderResource.ts:446
isDataUrl: boolean

Stores whether or not this url is a data url.

isLoading LoaderResource.ts:467
isLoading: boolean

Describes if this resource is currently loading. Is true when the resource starts loading, and is false again when complete.

loadType LoaderResource.ts:132
loadType: PIXI.LoaderResource.LOAD_TYPE

The method of loading to use for this resource.

metadata LoaderResource.ts:143
metadata: PIXI.IResourceMetadata

Extra info for middleware, and controlling specifics about how the resource loads.

Note that if you pass in a loadElement, the Resource class takes ownership of it. Meaning it will modify it as it sees fit.

name LoaderResource.ts:103
name: string

The name of this resource.

onAfterMiddleware LoaderResource.ts:208
onAfterMiddleware: PIXI.Signal

Dispatched after this resource has had all the after middleware run on it.

The callback looks like LoaderResource.OnCompleteSignal.

onComplete LoaderResource.ts:200
onComplete: PIXI.Signal

Dispatched once this resource has loaded, if there was an error it will be in the error property.

The callback looks like LoaderResource.OnCompleteSignal.

onProgress LoaderResource.ts:189
onProgress: PIXI.Signal

Dispatched each time progress of this resource load updates. Not all resources types and loader systems can support this event so sometimes it may not be available. If the resource is being loaded on a modern browser, using XHR, and the remote server properly sets Content-Length headers, then this will be available.

The callback looks like LoaderResource.OnProgressSignal.

onStart LoaderResource.ts:182
onStart: PIXI.Signal

Dispatched when the resource beings to load.

The callback looks like LoaderResource.OnStartSignal.

progressChunk LoaderResource.ts:176
progressChunk: number

The progress chunk owned by this resource.

spritesheet Spritesheet.ts:383
spritesheet: PIXI.Spritesheet

Reference to Spritesheet object created.

texture LoaderResource.ts:94
texture: PIXI.Texture

Texture reference for loading images and other textures.

textures Spritesheet.ts:390
textures: Object<string, PIXI.Texture>

Dictionary of textures from Spritesheet.

timeout LoaderResource.ts:125
timeout: number

A timeout in milliseconds for the load. If the load takes longer than this time it is cancelled and the load is considered a failure. If this value is set to 0 then there is no explicit timeout.

url LoaderResource.ts:109
url: string

The url used to load this resource.

xhr LoaderResource.ts:157
xhr: XMLHttpRequest

The XHR object that was used to load this resource. This is only set when loadType is LoaderResource.LOAD_TYPE.XHR.

xhrType LoaderResource.ts:137
xhrType: string

The type used to load the resource via XHR. If unset, determined automatically.

Public Methods


setExtensionLoadType LoaderResource.ts:277
static setExtensionLoadType(extname: string, loadType: PIXI.LoaderResource.LOAD_TYPE) → {void}

Sets the load type to be used for a specific extension.

Parameters:
Name Type Description
extname string

The extension to set the type for, e.g. "png" or "fnt"

loadType PIXI.LoaderResource.LOAD_TYPE

The load type to set it to.

Returns:
Type Description
void
setExtensionXhrType LoaderResource.ts:287
static setExtensionXhrType(extname: string, xhrType: PIXI.LoaderResource.XHR_RESPONSE_TYPE) → {void}

Sets the load type to be used for a specific extension.

Parameters:
Name Type Description
extname string

The extension to set the type for, e.g. "png" or "fnt"

xhrType PIXI.LoaderResource.XHR_RESPONSE_TYPE

The xhr type to set it to.

Returns:
Type Description
void
abort LoaderResource.ts:485
abort(message: string) → {void}

Aborts the loading of this resource, with an optional message.

Parameters:
Name Type Description
message string

The message to use for the error

Returns:
Type Description
void
complete LoaderResource.ts:478
complete() → {void}

Marks the resource as complete.

Returns:
Type Description
void
load LoaderResource.ts:533
load(cb: PIXI.LoaderResource.OnCompleteSignal) → {void}

Kicks off loading of this resource. This method is asynchronous.

Parameters:
Name Type Attributes Description
cb PIXI.LoaderResource.OnCompleteSignal

<optional>

Optional callback to call once the resource is loaded.

Returns:
Type Description
void

Powered by webdoc!