API Documentation for: 0.6.0
Show:

LoadItem Class

Defined in: LoadItem:40
Module: PreloadJS

Available since 0.6.0

All loaders accept an item containing the properties defined in this class. If a raw object is passed instead, it will not be affected, but it must contain at least a Src:property property. A string path or HTML tag is also acceptable, but it will be automatically converted to a LoadItem using the Create method by AbstractLoader

Constructor

LoadItem

()

Defined in LoadItem:40

Available since 0.6.0

Methods

create

(
  • value
)
Object | LoadItem static

Defined in create:172

Create/validate a LoadItem.

  • String-based items are converted to a LoadItem with a populated Src:property.
  • LoadItem instances are returned as-is
  • Objectss are returned as-is

Parameters:

Returns:

set

(
  • props
)
LoadItem

Defined in set:199

Provides a chainable shortcut method for setting a number of properties on the instance.

Example

 var loadItem = new createjs.LoadItem().set({src:"image.png", maintainOrder:true});

Parameters:

  • props Object

    A generic object containing properties to copy to the LoadItem instance.

Returns:

LoadItem:

Returns the instance the method is called on (useful for chaining calls.)

Properties

callback

String

Defined in callback:90

A callback used by JSONP requests that defines what global method to call when the JSONP content is loaded.

Default: null

crossOrigin

Boolean

Defined in crossOrigin:151

Sets the crossOrigin attribute for CORS-enabled images loading cross-domain.

Default: Anonymous

data

Object

Defined in data:98

An arbitrary data object, which is included with the loaded object.

Default: null

headers

Object

Defined in headers:124

An object hash of headers to attach to an XHR request. PreloadJS will automatically attach some default headers when required, including "Origin", "Content-Type", and "X-Requested-With". You may override the default headers by including them in your headers object.

Default: null

id

String

Defined in id:69

A string identifier which can be used to reference the loaded object. If none is provided, this will be automatically set to the Src:property.

Default: null

loadTimeout

Number

Defined in loadTimeout:159

The duration in milliseconds to wait before a request times out. This only applies to tag-based and and XHR (level one) loading, as XHR (level 2) provides its own timeout event.

Default: 8000 (8 seconds)

maintainOrder

Boolean

Defined in maintainOrder:78

Determines if a manifest will maintain the order of this item, in relation to other items in the manifest that have also set the maintainOrder property to true. This only applies when the max connections has been set above 1 (using setMaxConnections). Everything with this property set to false will finish as it is loaded. Ordered items are combined with script tags loading in order when maintainScriptOrder is set to true.

Default: false

method

String

Defined in method:106

The request method used for HTTP calls. Both GET or POST request types are supported, and are defined as constants on AbstractLoader.

Default: get

mimeType

String

Defined in mimeType:142

Set the mime type of XHR-based requests. This is automatically set to "text/plain; charset=utf-8" for text based files (json, xml, text, css, js).

Default: null

src

String

Defined in src:50

The source of the file that is being loaded. This property is required. The source can either be a string (recommended), or an HTML tag.

Default: null

type

String

Defined in type:59

The source of the file that is being loaded. This property is required. The source can either be a string (recommended), or an HTML tag. See the AbstractLoader class for the full list of supported types.

Default: null

values

Object

Defined in values:116

An object hash of name/value pairs to send to the server.

Default: null

withCredentials

Boolean

Defined in withCredentials:134

Enable credentials for XHR requests.

Default: false