1 /**
  2  * The MIT License (MIT)
  3  *
  4  * Copyright (c) 2016 DeNA Co., Ltd.
  5  *
  6  * Permission is hereby granted, free of charge, to any person obtaining a copy
  7  * of this software and associated documentation files (the "Software"), to deal
  8  * in the Software without restriction, including without limitation the rights
  9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 10  * copies of the Software, and to permit persons to whom the Software is
 11  * furnished to do so, subject to the following conditions:
 12  *
 13  * The above copyright notice and this permission notice shall be included in
 14  * all copies or substantial portions of the Software.
 15  *
 16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 22  * SOFTWARE.
 23  */
 24 
 25 /// <reference path="base.js"/>
 26 /// <reference path="event_dispatcher.js"/>
 27 /// <reference path="loader.js"/>
 28 /// <reference path="file_event.js"/>
 29 /// <reference path="sound.js"/>
 30 
 31 /**
 32  * A class that downloads resources. This class automatically chooses the best
 33  * method and sends cross-origin requests, i.e. this class ignores the
 34  * 'opt_useXHR' parameter and the 'opt_crossOrigin' one.
 35  * @param {boolean=} opt_useXHR
 36  * @param {string=} opt_basePath
 37  * @param {string|boolean=} opt_crossOrigin
 38  * @extends {createjs.EventDispatcher}
 39  * @implements {createjs.Loader.Listener}
 40  * @constructor
 41  */
 42 createjs.LoadQueue = function(opt_useXHR, opt_basePath, opt_crossOrigin) {
 43   /// <signature>
 44   ///   <param type="boolean" optional="true" name="opt_useXHR"/>
 45   ///   <param type="string" optional="true" name="opt_basePath"/>
 46   ///   <param type="boolean" optional="true" name="opt_crossOrigin"/>
 47   /// </signature>
 48   /// <signature>
 49   ///   <param type="boolean" optional="true" name="opt_useXHR"/>
 50   ///   <param type="string" optional="true" name="opt_basePath"/>
 51   ///   <param type="string" optional="true" name="opt_crossOrigin"/>
 52   /// </signature>
 53   createjs.EventDispatcher.call(this);
 54 
 55   /**
 56    * A path to be prepended onto the source URLs of its items.
 57    * @type {string}
 58    * @private
 59    */
 60   this.basePath_ = opt_basePath || '';
 61 
 62   /**
 63    * A list of items that have not yet started downloading.
 64    * @type {Array.<createjs.Loader>}
 65    * @private
 66    */
 67   this.queue_ = [];
 68 
 69   /**
 70    * An array containing the currently downloading files.
 71    * @type {Array.<createjs.Loader>}
 72    * @private
 73    */
 74   this.loading_ = [];
 75 
 76   /**
 77    * A mapping table either from a source or from an ID name to a
 78    * createjs.Loader.Item Object.
 79    * @type {Object.<string,createjs.Loader.Item>}
 80    * @private
 81    */
 82   this.items_ = {};
 83 
 84   /**
 85    * A list of scripts being loaded.
 86    * @type {Array.<createjs.Loader.Item>}
 87    * @private
 88    */
 89   this.scripts_ = [];
 90 
 91   /**
 92    * An observer who monitors the activities of this object.
 93    * @type {createjs.LoadQueue.Listener}
 94    * @private
 95    */
 96   this.listener_ = new createjs.Sound.Proxy();
 97 };
 98 createjs.inherits('LoadQueue', createjs.LoadQueue, createjs.EventDispatcher);
 99 
100 /**
101  * An interface that observes activities of a LoadQueue object.
102  * @interface
103  */
104 createjs.LoadQueue.Listener = function() {};
105 
106 /**
107  * Called when a LoadQueue object starts loading a file.
108  * @param {createjs.Loader.Item} item
109  */
110 createjs.LoadQueue.Listener.prototype.handleFileStart = function(item) {
111   /// <param type="createjs.Loader.Item" name="item"/>
112 };
113 
114 /**
115  * Called when a LoadQueue object has finished loading a file.
116  * @param {createjs.Loader.Item} item
117  * @return {boolean}
118  */
119 createjs.LoadQueue.Listener.prototype.handleFileComplete = function(item) {
120   /// <param type="createjs.Loader.Item" name="item"/>
121   /// <returns type="boolean"/>
122 };
123 
124 /**
125  * A list of observers who monitors the activities of this object.
126  * @type {createjs.LoadQueue.Listener}
127  * @private
128  */
129 createjs.LoadQueue.prototype.listener_ = null;
130 
131 /**
132  * Whether this object has started loading files.
133  * @type {boolean}
134  * @private
135  */
136 createjs.LoadQueue.prototype.started_ = false;
137 
138 /**
139  * Whether this loader has been canceled loading files.
140  * @type {boolean}
141  * @private
142  */
143 createjs.LoadQueue.prototype.canceled_ = false;
144 
145 /**
146  * Whether this loader stops loading files.
147  * @type {boolean}
148  * @private
149  */
150 createjs.LoadQueue.prototype.paused_ = true;
151 
152 /**
153  * The total load progress (percentage) of this object.
154  * @type {number}
155  * @private
156  */
157 createjs.LoadQueue.prototype.progress_ = 0;
158 
159 /**
160  * The maximum number of network connections.
161  * @type {number}
162  * @private
163  */
164 createjs.LoadQueue.prototype.connections_ = 1;
165 
166 /**
167  * The number of requested items.
168  * @type {number}
169  * @private
170  */
171 createjs.LoadQueue.prototype.requested_ = 0;
172 
173 /**
174  * The number of loaded items.
175  * @type {number}
176  * @private
177  */
178 createjs.LoadQueue.prototype.loaded_ = 0;
179 
180 /**
181  * Determines if the load has been canceled.
182  * @return {boolean}
183  * @private
184  */
185 createjs.LoadQueue.prototype.isCanceled_ = function() {
186   /// <returns type="boolean"/>
187   return this.canceled_;
188 };
189 
190 /**
191  * Sends an error event.
192  * @param {Object} item
193  * @param {string} text
194  * @private
195  */
196 createjs.LoadQueue.prototype.sendError_ = function(item, text) {
197   /// <param type="createjs.Loader.Item" name="item"/>
198   /// <param type="string" name="text"/>
199   if (!this.isCanceled_() && this.hasListener('error')) {
200     this.dispatchRawEvent(
201         new createjs.FileErrorEvent('error', false, false, item, text));
202   }
203 };
204 
205 /**
206  * Sends a file-load event.
207  * @param {createjs.Loader.Item} item
208  * @private
209  */
210 createjs.LoadQueue.prototype.sendFileLoad_ = function(item) {
211   /// <param type="createjs.Loader.Item" name="item"/>
212   if (!this.isCanceled_()) {
213     createjs.assert(!!this.listener_);
214     if (this.listener_.handleFileComplete(item)) {
215       this.disposeItem_(item);
216     }
217     if (this.hasListener('fileload')) {
218       var event = new createjs.FileLoadEvent(
219           'fileload', false, false, item.exportValues(),
220           item.resultObject, item.resultText);
221       this.dispatchRawEvent(event);
222     }
223   }
224 };
225 
226 /**
227  * Create a loader for loading the specified item.
228  * @param {createjs.Loader.Item} item
229  * @return {createjs.Loader}
230  * @private
231  */
232 createjs.LoadQueue.prototype.createLoader_ = function(item) {
233   /// <param type="createjs.Loader.Item" name="item"/>
234   /// <returns type="createjs.Loader"/>
235   return new createjs.Loader(this, item);
236 };
237 
238 /**
239  * Updates the total progress of this loader and sends a progress event.
240  * For example, if 5/10 items have loaded, and item 6 is 20% loaded, the total
241  * progress would be:
242  *  * 5/10 of the items in the queue (50%)
243  *  * plus 20% of item 6's slot (2%)
244  *  * equals 52%
245  * @private
246  */
247 createjs.LoadQueue.prototype.updateProgress_ = function() {
248   var reciprocal = 1 / this.requested_;
249   var loaded = this.loaded_ * reciprocal;
250   if (this.requested_ > this.loaded_) {
251     var chunk = 0;
252     var length =  this.loading_.length;
253     for (var i = 0; i < length; ++i) {
254       chunk += this.loading_[i].getProgress();
255     }
256     loaded += chunk * reciprocal;
257   }
258   this.progress_ = loaded;
259 
260   // Sends a progress event if there are event listeners attached to this
261   // loader.
262   if (!this.isCanceled_() && this.hasListener('progress')) {
263     this.dispatchRawEvent(new createjs.ProgressEvent('progress',
264                                                      false,
265                                                      false,
266                                                      this.progress_,
267                                                      1,
268                                                      this.progress_));
269   }
270 };
271 
272 /**
273  * Removes a loader.
274  * @param {createjs.Loader} loader
275  * @private
276  */
277 createjs.LoadQueue.prototype.removeLoader_ = function(loader) {
278   /// <param type="createjs.Loader" name="loader"/>
279   var length = this.loading_.length;
280   for (var i = 0; i < length; ++i) {
281     if (this.loading_[i] == loader) {
282       this.loading_.splice(i, 1);
283       return;
284     }
285   }
286 };
287 
288 /**
289  * Creates a loader item and adds it to this queue.
290  * @param {Object} value
291  * @private
292  */
293 createjs.LoadQueue.prototype.loadItem_ = function(value) {
294   /// <param type="Object" name="value"/>
295   var item = new createjs.Loader.Item();
296   item.initializeItem(value, this.basePath_);
297   this.items_[item.getSource()] = item;
298   if (item.getSource() != item.id) {
299     this.items_[item.id] = item;
300   }
301   this.listener_.handleFileStart(item)
302 
303   var loader = new createjs.Loader(this, item);
304   this.queue_.push(loader);
305   ++this.requested_;
306   this.updateProgress_();
307   if (item.isScript()) {
308     this.scripts_.push(item);
309   }
310 };
311 
312 /**
313  * Cleans out item results, to free them from memory. Mainly, the loaded item
314  * and results are cleared from internal hashes.
315  * @param {createjs.Loader.Item} item
316  * @private
317  */
318 createjs.LoadQueue.prototype.disposeItem_ = function(item) {
319   /// <param type="createjs.Loader.Item" name="item"/>
320   this.items_[item.getSource()] = null;
321   this.items_[item.id] = null;
322 };
323 
324 /**
325  * Loads the next item in the queue.
326  * @private
327  */
328 createjs.LoadQueue.prototype.loadNext_ = function() {
329   if (this.paused_) {
330     return;
331   }
332 
333   // Dispatch a 'loadstart' event when this queue is going to load the first
334   // item.
335   if (!this.started_) {
336     if (!this.isCanceled_() && this.hasListener('loadstart')) {
337       this.dispatchNotification('loadstart');
338     }
339     this.started_ = true;
340   }
341 
342   // Dispatch a 'complete' event when this queue finishes loading all items.
343   this.loaded = this.requested_ == this.loaded_;
344   if (this.loaded) {
345     if (!this.isCanceled_()) {
346       this.dispatchNotification('complete');
347     }
348   } else {
349     // Start loading items in the load queue. The following 'loader.load()' call
350     // recursively calls this method when its specified resource is cached, i.e.
351     // the 'loading_' property and the 'queue_' property may be changed in the
352     // call. To avoid reading an item from an empty queue, this loop has to
353     // read the queue length in it directly without caching it.
354     for (var i = 0; i < this.connections_ - this.loading_.length; ++i) {
355       if (!this.queue_.length) {
356         break;
357       }
358       var loader = this.queue_.shift();
359       this.loading_.push(loader);
360       loader.load();
361     }
362   }
363 };
364 
365 /**
366  * Changes whether to use XMLHttpRequest objects to load files. (The
367  * createjs.Loader class uses XMLHttpRequest v2 whenever possible and it ignores
368  * this setting.)
369  * @param {boolean} useXHR
370  * @return {boolean}
371  * @const
372  */
373 createjs.LoadQueue.prototype.setUseXHR = function(useXHR) {
374   /// <param type="boolean" name="useXHR"/>
375   /// <returns type="boolean"/>
376   return useXHR;
377 };
378 
379 /**
380  * Registers a plug-in.
381  * @param {Object} plugin
382  * @const
383  */
384 createjs.LoadQueue.prototype.installPlugin = function(plugin) {
385   /// <param type="Object" name="plugin"/>
386   createjs.notReached();
387 };
388 
389 /**
390  * Retrieves a loaded result with either an ID or a source. This method returns
391  * the content if it has been loaded.
392  * * An HTMLImageElement object for image files.
393  * * An HTMLAudioElement object for audio files. (This method returns null if
394  *   the createjs.Sound class uses the WebAudio API.)
395  * * An HTMLScriptElement object for JavaScript files.
396  * * An HTMLStyleElement object for CSS files.
397  * * A string primitive for TEXT files.
398  * * A JavaScript object for JSON files.
399  * @param {string} value
400  * @param {boolean=} opt_rawResult
401  * @return {*}
402  * @const
403  */
404 createjs.LoadQueue.prototype.getResult = function(value, opt_rawResult) {
405   /// <signature>
406   ///   <param type="string" name="value"/>
407   ///   <param type="boolean" optional="true" name="opt_rawResult"/>
408   ///   <returns type="HTMLElement"/>
409   /// </signature>
410   /// <signature>
411   ///   <param type="string" name="value"/>
412   ///   <param type="boolean" optional="true" name="opt_rawResult"/>
413   ///   <returns type="string"/>
414   /// </signature>
415   /// <signature>
416   ///   <param type="string" name="value"/>
417   ///   <param type="boolean" optional="true" name="opt_rawResult"/>
418   ///   <returns type="Object"/>
419   /// </signature>
420   var item = this.items_[value];
421   if (!item) {
422     return null;
423   }
424   if (!!opt_rawResult && item.resultText) {
425     return item.resultText;
426   }
427   return item.resultObject;
428 };
429 
430 /**
431  * Stops all queued and loading items, and clears the queue.
432  * @const
433  */
434 createjs.LoadQueue.prototype.removeAll = function() {
435   this.close();
436   this.items_ = {};
437   createjs.LoadQueue.call(this, true);
438 };
439 
440 /**
441  * Removes an item from the loading queue. This method sops an item from being
442  * loaded, and removes it from the queue. If nothing is passed, all items are
443  * removed. This also removes internal references to loaded item(s).
444  *
445  * Example
446  *   queue.loadManifest([
447  *     { 'src': 'test.png', 'id': 'png' },
448  *     { 'src': 'test.jpg', 'id': 'jpg' },
449  *     { 'src': 'test.mp3', 'id': 'mp3' }
450  *   ]);
451  *   queue.remove('png'); // Single item by ID
452  *   queue.remove('png', 'test.jpg'); // Items as arguments. Mixed id and src.
453  *   queue.remove(['test.png', 'jpg']); // Items in an Array. Mixed id and src.
454  *
455  * @param {...(string|Array.<string>)} var_args
456  * @const
457  */
458 createjs.LoadQueue.prototype.remove = function(var_args) {
459   /// <signature>
460   ///   <param type="string" name="source"/>
461   /// </signature>
462   /// <signature>
463   ///   <param type="Array" type="string" name="sources"/>
464   /// </signature>
465   createjs.notReached();
466 };
467 
468 /**
469  * Sets the maximum number of concurrent connections.
470  * @param {number} value
471  * @const
472  */
473 createjs.LoadQueue.prototype.setMaxConnections = function(value) {
474   /// <param type="number" name="value"/>
475   this.connections_ = value;
476   if (!this.paused_ && this.queue_.length > 0) {
477     this.loadNext_();
478   }
479 };
480 
481 /**
482  * Loads a single file.
483  * @param {Object | string} file
484  * The file object or path to load. A file can be either:
485  *   1. A string path to a resource, or;
486  *   2. An object that contains:<ul>
487  *     * src
488  *       The source of the file that is being loaded. This property is required.
489  *       The source can either be a string (recommended), or an HTML tag.
490  *     * type
491  *       The type of file that will be loaded (image, sound, json, etc).
492  *       PreloadJS does auto-detection of types using the extension. Supported
493  *       types are defined on LoadQueue, such as LoadQueue.IMAGE. It is
494  *       recommended that a type is specified when a non-standard file URI (such
495  *       as a PHP script) us used.
496  *     * id
497  *       A string identifier which can be used to reference the loaded object.
498  *     * callback (optional)
499  *       used for JSONP requests, to define what method to call when the JSONP
500  *       is loaded.
501  *     * data
502  *       An arbitrary data object, which is included with the loaded object.
503  *     * method
504  *       used to define if this request uses GET or POST when sending data to
505  *       the server. The default value is "GET".
506  *     * values (optional)
507  *       An object of name/value pairs to send to the server.
508  *     * headers (optional)
509  *       An object hash of headers to attach to an XHR request.
510  * @param {boolean=} opt_loadNow
511  * @param {string=} opt_basePath
512  * @const
513  */
514 createjs.LoadQueue.prototype.loadFile =
515     function(file, opt_loadNow, opt_basePath) {
516   /// <signature>
517   ///   <param type="string" name="source"/>
518   ///   <param type="boolean" optional="true" name="opt_loadNow"/>
519   ///   <param type="string" optional="true" name="opt_basePath"/>
520   /// </signature>
521   /// <signature>
522   ///   <param type="Object" name="item"/>
523   ///   <param type="boolean" optional="true" name="opt_loadNow"/>
524   ///   <param type="string" optional="true" name="opt_basePath"/>
525   /// </signature>
526   if (!file) {
527     this.sendError_({}, 'PRELOAD_NO_FILE');
528     return;
529   }
530   var item = createjs.isString(file) ?
531       { 'src': createjs.getString(file) } : createjs.getObject(file);
532   this.loadItem_(item);
533   this.setPaused(opt_loadNow == null ? false : !opt_loadNow);
534 };
535 
536 /**
537  * Loads an array of files.
538  * @param {Array|string|Object} manifest
539  * An list of files to load. The loadManifest call supports four types of
540  * manifests:
541  *   1. A string path, which points to a manifest file, which is a JSON file
542  *      that contains a manifest property, which defines the list of files to
543  *      load, and can optionally contain a path property, which will be
544  *      prepended to each file in the list.
545  *   2. An array of files to load.
546  *   3. An object which defines a src property, which is a JSON or JSONP file. A
547  *      callback property can be defined for JSONP file. The JSON/JSONP file
548  *      should contain a manifest property, which defines the list of files to
549  *      load, and can optionally contain a "path" property, which will be
550  *      prepended to each file in the list.
551  *   4. An object which contains a manifest property, which defines the list of
552  *      files to load, and can optionally contain a path property, which will be
553  *      prepended to each file in the list.
554  * See the loadFile() method for description about a file.
555  *
556  * @param {boolean=} opt_loadNow
557  * @param {string=} opt_basePath
558  * @const
559  */
560 createjs.LoadQueue.prototype.loadManifest =
561     function(manifest, opt_loadNow, opt_basePath) {
562   /// <signature>
563   ///   <param type="string" name="source"/>
564   ///   <param type="boolean" optional="true" name="opt_loadNow"/>
565   ///   <param type="string" optional="true" name="opt_basePath"/>
566   /// </signature>
567   /// <signature>
568   ///   <param type="Array" elementType="string" name="sources"/>
569   ///   <param type="boolean" optional="true" name="opt_loadNow"/>
570   ///   <param type="string" optional="true" name="opt_basePath"/>
571   /// </signature>
572   /// <signature>
573   ///   <param type="Object" name="items"/>
574   ///   <param type="boolean" optional="true" name="opt_loadNow"/>
575   ///   <param type="string" optional="true" name="opt_basePath"/>
576   /// </signature>
577   // Always treat the input manifest as an array. Some old browsers (e.g.
578   // Android browsers) do not treat array-like objects (e.g. JSON arrays,
579   // Arguments, NodeList, etc.) as arrays. This method always treats the first
580   // argument as an array to avoid adding workarounds for these browsers. (Most
581   // games call this method with an array.)
582   var files = /** @type {Array} */ (manifest);
583   if (!files.length) {
584     this.sendError_({}, 'INVALID_MANIFEST');
585     createjs.notReached();
586     return;
587   }
588   for (var i = 0; i < files.length; ++i) {
589     this.loadItem_(files[i]);
590   }
591   this.setPaused(opt_loadNow == null ? false : !opt_loadNow);
592 };
593 
594 /**
595  * Retrieves a preload item provided by applications from an ID or a source.
596  * @param {string} value
597  * @return {Object}
598  * @const
599  */
600 createjs.LoadQueue.prototype.getItem = function(value) {
601   /// <param type="string" name="value"/>
602   /// <returns type="Object"/>
603   return this.items_[value].exportValues();
604 };
605 
606 /**
607  * Pauses loading items or resumes it.
608  * @param {boolean} value
609  * @const
610  */
611 createjs.LoadQueue.prototype.setPaused = function(value) {
612   /// <param type="string" name="value"/>
613   this.paused_ = value;
614   if (!this.paused_) {
615     this.loadNext_();
616   }
617 };
618 
619 /**
620  * Starts loading files added to this queue.
621  * @const
622  */
623 createjs.LoadQueue.prototype.load = function() {
624   this.setPaused(false);
625 };
626 
627 /**
628  * Closes the active queue.
629  * @const
630  */
631 createjs.LoadQueue.prototype.close = function() {
632   for (var i = 0; i < this.loading_.length; ++i) {
633     this.loading_[i].cancel();
634   }
635   this.loading_ = [];
636   this.scripts_ = [];
637   this.loadedScripts_ = [];
638   this.started_ = false;
639 };
640 
641 /**
642  * Resets this loader. This method stops all open loads, destroys any loaded
643  * items, and reloads all items in the queue.
644  * @const
645  */
646 createjs.LoadQueue.prototype.reset = function() {
647   this.close();
648   this.queue_ = [];
649   this.items_ = {};
650   this.requested_ = 0;
651   this.loaded_ = 0;
652 };
653 
654 /** @override */
655 createjs.LoadQueue.prototype.handleFileComplete = function(loader) {
656   /// <param type="createjs.Loader" name="loader"/>
657   this.removeLoader_(loader);
658   var item = loader.getItem();
659   if (item.isScript()) {
660     // Count the number of loaded scripts from the beginning to sort the loaded
661     // scripts in the order requested by this object.
662     var length = this.scripts_.length;
663     var index = 0;
664     for (index = 0; index < length; ++index) {
665       if (!this.scripts_[index].resultObject) {
666         break;
667       }
668     }
669     if (index > 0) {
670       for (var i = 0; i < index; ++i) {
671         // Add JavaScript files to the DOM tree in the order added to this
672         // LoadQueue object, and send a 'fileload' event. (Games expect a
673         // 'fileload' is dispatched AFTER a <script> element is added to the DOM
674         // tree.)
675         var script = this.scripts_[i];
676         document.body.appendChild(
677             /** @type {HTMLScriptElement} */ (script.resultObject));
678         this.sendFileLoad_(script);
679       }
680       this.scripts_.splice(0, index);
681     }
682   } else {
683     this.sendFileLoad_(item);
684   }
685   ++this.loaded_;
686   this.updateProgress_();
687   this.loadNext_();
688 };
689 
690 /** @override */
691 createjs.LoadQueue.prototype.handleFileError = function(loader, type, message) {
692   /// <param type="createjs.Loader" name="loader"/>
693   /// <param type="string" name="type"/>
694   /// <param type="string" name="message"/>
695   ++this.loaded_;
696   this.updateProgress_();
697   this.sendError_(loader.getItem().exportValues(), 'FILE_LOAD_ERROR');
698   this.removeLoader_(loader);
699   this.loadNext_();
700 };
701 
702 // Export the createjs.LoadQueue object to the global namespace.
703 createjs.exportObject('createjs.LoadQueue', createjs.LoadQueue, {
704   'setUseXHR': createjs.LoadQueue.prototype.setUseXHR,
705   'installPlugin': createjs.LoadQueue.prototype.installPlugin,
706   'getResult': createjs.LoadQueue.prototype.getResult,
707   'removeAll': createjs.LoadQueue.prototype.removeAll,
708   'remove': createjs.LoadQueue.prototype.remove,
709   'setMaxConnections': createjs.LoadQueue.prototype.setMaxConnections,
710   'loadFile': createjs.LoadQueue.prototype.loadFile,
711   'loadManifest': createjs.LoadQueue.prototype.loadManifest,
712   'getItem': createjs.LoadQueue.prototype.getItem,
713   'setPaused': createjs.LoadQueue.prototype.setPaused,
714   'load': createjs.LoadQueue.prototype.load,
715   'close': createjs.LoadQueue.prototype.close,
716   'reset': createjs.LoadQueue.prototype.reset
717 }, {
718   'BINARY': 'binary',
719   'CSS': 'css',
720   'IMAGE': 'image',
721   'JAVASCRIPT': 'javascript',
722   'JSON': 'json',
723   'JSONP': 'jsonp',
724   'MANIFEST': 'manifest',
725   'SOUND': 'sound',
726   'SVG': 'svg',
727   'TEXT': 'text',
728   'XML': 'xml'
729 });
730