LoadQueue


Module hilo/loader/LoadQueue Requires hilo/core/Class, hilo/event/EventMixin, hilo/loader/ImageLoader, hilo/loader/ScriptLoader Source LoadQueue.js
LoadQueue is a queue-like loader.

Properties

Property Defined
the limited concurrent connections.
LoadQueue

Methods

Method Defined
LoadQueue(source:Object)
Constructor
LoadQueue
add(source:Object|Array):LoadQueue
Add desired resource,could be a single object or array resource.
LoadQueue
fire(type:String, detail:Object):Boolean
Send events.
LoadQueue
get(specified:String):Object
get resource object by id or src
LoadQueue
getContent(specified:String):Object
get resource object content by id or src
LoadQueue
getLoaded():Uint
get loaded resource count
LoadQueue
getSize(identify:Boolean):Number
get resource size, loaded or all.
LoadQueue
getTotal():Uint
get all resource count
LoadQueue
off(type:String, listener:Function):Object
Remove one event listener.
LoadQueue
on(type:String, listener:Function, once:Boolean):Object
Add an event listenser.
LoadQueue
removeContent(specified:String)
remove resource object content by id or src
LoadQueue
start():LoadQueue
start loading
LoadQueue

Property Detail

maxConnections:Int
the limited concurrent connections. default value 2.

Constructor

LoadQueue(source:Object)
parameters
source:Object — resource that need to be loaded,could be a single object or array resource.

Method Detail

add(source:Object|Array):LoadQueue
Add desired resource,could be a single object or array resource.
parameters
source:Object|Array — ,a single object or array resource. Each resource contains properties like below:
  • id - resource identifier
  • src - resource url
  • type - resource type. By default, we automatically identify resource by file suffix and choose the relevant loader for you
  • loader - specified resource loader. If you specify this,we abandon choosing loader inside
  • noCache - a tag that set on or off to prevent cache,implemented by adding timestamp inside
  • size - predicted resource size, help calculating loading progress
  • crossOrigin - Whether cross-domain is needed, default is false
return
LoadQueue — 下载队列实例本身。
fire(type:String, detail:Object):Boolean
Send events. If the first parameter is an Object, take it as an Event Object.
parameters
type:String — Event type to send.
detail:Object — The detail (parameters go with the event) of Event to send.
return
Boolean — Whether Event call successfully.
get(specified:String):Object
get resource object by id or src
parameters
specified:String — id or src
return
Object — resource object
getContent(specified:String):Object
get resource object content by id or src
parameters
specified:String — id or src
return
Object — resource object content
getLoaded():Uint
get loaded resource count
return
Uint — loaded resource count
getSize(identify:Boolean):Number
get resource size, loaded or all.
parameters
identify:Boolean — loaded or all resource. default is false, return all resource size. when set true, return loaded resource size.
return
Number — resource size.
getTotal():Uint
get all resource count
return
Uint — all resource count
off(type:String, listener:Function):Object
Remove one event listener. Remove all event listeners if no parameter provided, and remove all event listeners on one type which is provided as the only parameter.
parameters
type:String — The type of event listener that want to remove.
listener:Function — Event listener callback function to be removed.
return
Object — The Event itself. Functions chain call supported.
on(type:String, listener:Function, once:Boolean):Object
Add an event listenser.
parameters
type:String — Event type to listen.
listener:Function — Callback function of event listening.
once:Boolean — Listen on event only once and no more response after the first response?
return
Object — The Event itself. Functions chain call supported.
removeContent(specified:String)
remove resource object content by id or src
parameters
specified:String — id or src
start():LoadQueue
start loading
return
LoadQueue — the loading instance