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 /**
 26  * The top-level namespace of this library. All objects in this library must be
 27  * defined under this namespace to prevent exporting them to the global
 28  * namespace.
 29  * @namespace createjs
 30  */
 31 var createjs = {};
 32 
 33 /**
 34  * Represents the major version of the original CreateJS library.
 35  * @define {number}
 36  */
 37 createjs.MAJOR_VERSION = 7;
 38 
 39 /**
 40  * Represents the minor version of the original CreateJS library.
 41  * @define {number}
 42  */
 43 createjs.MINOR_VERSION = 1;
 44 
 45 /**
 46  * Represents the major version of this library.
 47  * @define {number}
 48  */
 49 createjs.DENA_MAJOR_VERSION = 0;
 50 
 51 /**
 52  * Represents the minor version of this library.
 53  * @define {number}
 54  */
 55 createjs.DENA_MINOR_VERSION = 7;
 56 
 57 /**
 58  * Represents the build number of this library. (This define is a placeholder
 59  * and overridden by make.)
 60  * @define {number}
 61  */
 62 createjs.DENA_BUILD_NUMBER = 0;
 63 
 64 /**
 65  * Represents the patch level of this library. (This define is a placeholder and
 66  * overridden by make.)
 67  * @define {number}
 68  */
 69 createjs.DENA_PATCH_LEVEL = 0;
 70 
 71 /**
 72  * Represents whether this library is compiled with the Closure compiler.
 73  * @define {boolean}
 74  */
 75 createjs.COMPILED = false;
 76 
 77 /**
 78  * Represents whether to enable debugging features.
 79  * @define {boolean}
 80  */
 81 createjs.DEBUG = true;
 82 
 83 /**
 84  * An alias of true. (This define is used only for commenting out unused code.)
 85  * @define {boolean}
 86  */
 87 createjs.TRUE = true;
 88 
 89 /**
 90  * An alias of false. (This define is used only for commenting out unused code.)
 91  * @define {boolean}
 92  */
 93 createjs.FALSE = false;
 94 
 95 /**
 96  * Represents whether this library uses a network cache.
 97  * @define {boolean}
 98  */
 99 createjs.USE_CACHE = false;
100 
101 /**
102  * Represents the database name used by our network cache.
103  * @define {string}
104  */
105 createjs.CACHE_DATABASE = 'DeNA';
106 
107 /**
108  * Represents the table name used by our network cache.
109  * @define {string}
110  */
111 createjs.CACHE_TABLE = 'CreateJS';
112 
113 /**
114  * Represents the default texture format. This value is used in creating WebGL
115  * textures from HTML elements (i.e. <img> elements, <canvas> elements, and
116  * <video> elements) that do not specify their texture types.
117  *   +-------+------------------------+
118  *   | value | texture format         |
119  *   +-------+------------------------+
120  *   | 0     | UNSIGNED_BYTE          |
121  *   | 1     | UNSIGNED_SHORT_4_4_4_4 |
122  *   | 2     | UNSIGNED_SHORT_5_5_5_1 |
123  *   | 3     | UNSIGNED_SHORT_5_6_5   |
124  *   +-------+------------------------+
125  * @define {number}
126  */
127 createjs.DEFAULT_TEXTURE = 1;
128 
129 /**
130  * Represents whether to create a module compliant with AMD (Asynchronous Module
131  * Definition).
132  * @define {boolean}
133  */
134 createjs.SUPPORT_AMD = false;
135 
136 /**
137  * Represents whether the createjs.Sound class uses an <iframe> element to play
138  * sounds. (This is a workaround for Chrome for Android, where it is slow to
139  * decode audio.)
140  * @define {boolean}
141  */
142 createjs.USE_FRAME = true;
143 
144 /**
145  * Represents whether to read pixels in hit-testing.
146  * @define {boolean}
147  */
148 createjs.USE_PIXEL_TEST = true;
149 
150 /**
151  * A reference to the global context. (This is used as a short-cut to the global
152  * Window object.)
153  * @const {Window}
154  */
155 createjs.global = this;
156 
157 /**
158  * The URL interface.
159  * @type {URL}
160  */
161 createjs.URL =
162     createjs.global['URL'] || createjs.global['webkitURL'];
163 
164 /**
165  * The constructor of the BlobBuilder class.
166  * @type {function(new:BlobBuilder)}
167  */
168 createjs.BlobBuilder = createjs.global['WebKitBlobBuilder'];
169 
170 /**
171  * The constructor of the AudioContext class.
172  * @const {function(new:AudioContext)}
173  */
174 createjs.AudioContext =
175     createjs.global['webkitAudioContext'] || createjs.global['AudioContext'];
176 
177 /**
178  * The commands used for communicating with a createjs.FramePlayer object,
179  * which runs on an <iframe> element.
180  * @enum {number}
181  */
182 createjs.FrameCommand = {
183   LOAD: 0,
184   PLAY: 1,
185   STOP: 2,
186   SET_VOLUME: 3,
187   INITIALIZE: 4,
188   TOUCH: 5,
189   DECODE: 6,
190   END: 7,
191   CLONE: 8
192 };
193 
194 /**
195  * The current origin.
196  * @type {string}
197  */
198 createjs.origin_ = location.origin || location.protocol + '//' + location.host;
199 
200 /**
201  * Writes a log message to a console.
202  * @param {string} message
203  */
204 createjs.log = function(message) {
205   /// <param type="string" name="message"/>
206   if ((createjs.DEBUG) && createjs.global.console) {
207     console.log(message);
208   }
209 };
210 
211 /**
212  * Writes a log message to a console.
213  * @param {string} message
214  */
215 createjs.debug = function(message) {
216   /// <param type="string" name="message"/>
217   if (createjs.DEBUG) {
218     createjs.log(message);
219   }
220 };
221 
222 /**
223  * Throws an error.
224  * @param {string} message
225  */
226 createjs.error = function(message) {
227   /// <param type="string" name="message"/>
228   throw new Error(message);
229 };
230 
231 /**
232  * Throws an error if the specified condition is false.
233  * @param {boolean} condition
234  */
235 createjs.assert = function(condition) {
236   /// <param type="boolean" name="condition"/>
237   if (createjs.DEBUG && !condition) {
238     createjs.error('assertion failed');
239   }
240 };
241 
242 /**
243  * Writes a 'NOT IMPLEMENTED' error to the debug console.
244  */
245 createjs.notImplemented = function() {
246   if (createjs.DEBUG) {
247     createjs.debug('NOT IMPLEMENTED');
248   }
249 };
250 
251 /**
252  * Writes a 'NOT REACHED' message. This function is put the place where its code
253  * should not be executed to tell callers that they did unsupported behaviors.
254  */
255 createjs.notReached = function() {
256   createjs.debug('NOT REACHED');
257 };
258 
259 /**
260  * Inherits the prototype methods from a parent constructor into a child one.
261  * This function creates a temporary class that copies the prototype methods of
262  * the parent class and creates it to avoid calling the parent constructor
263  * directly. (It may cause a crash to call the parent constructor without
264  * arguments.)
265  * @param {string} name
266  * @param {Function} child
267  * @param {Function} parent
268  */
269 createjs.inherits = function(name, child, parent) {
270   /// <param type="string" name="name"/>
271   /// <param type="Function" name="child"/>
272   /// <param type="Function" name="parent"/>
273   child.superClass_ = parent.prototype;
274   createjs.assert(!!Object.create);
275   child.prototype = Object.create(parent.prototype);
276   /** @override */
277   child.prototype.constructor = child;
278 };
279 
280 /**
281  * Exposes an object and its member methods to the global namespace path.
282  * @param {string} name
283  * @param {Object} object
284  * @param {Object.<string,Function>} methods
285  * @param {Object.<string,Function>=} opt_statics
286  */
287 createjs.exportObject = function(name, object, methods, opt_statics) {
288   /// <param type="string" name="name"/>
289   /// <param type="Object" name="object"/>
290   /// <param type="Object" name="methods"/>
291   /// <param type="Object" optional="true" name="opt_statics"/>
292   if (!createjs.SUPPORT_AMD) {
293     var context = createjs.global;
294     var parts = name.split('.');
295     var length = parts.length - 1;
296     for (var i = 0; i < length; ++i) {
297       var part = parts[i];
298       if (!context[part]) {
299         context[part] = {};
300       }
301       context = context[part];
302     }
303     context[parts[length]] = object;
304   }
305   for (var key in methods) {
306     object.prototype[key] = methods[key];
307   }
308   // Export the constructor method 'initialize' used by CreateJS.
309   object.prototype['initialize'] = object;
310 
311   if (opt_statics) {
312     for (var key in opt_statics) {
313       object[key] = opt_statics[key];
314     }
315   }
316 };
317 
318 /**
319  * Exposes static methods to the global namespace path.
320  * @param {string} name
321  * @param {Object.<string,Function|string|number>} methods
322  * @return {Object}
323  */
324 createjs.exportStatic = function(name, methods) {
325   /// <param type="string" name="name"/>
326   /// <param type="Object" name="methods"/>
327   /// <returns type="Object"/>
328   var context = createjs.SUPPORT_AMD ? {} : createjs.global;
329   if (!createjs.SUPPORT_AMD) {
330     var parts = name.split('.');
331     var length = parts.length;
332     for (var i = 0; i < length; ++i) {
333       var part = parts[i];
334       if (!context[part]) {
335         context[part] = {};
336       }
337       context = context[part];
338     }
339   }
340   for (var key in methods) {
341     context[key] = methods[key];
342   }
343   return context;
344 };
345 
346 /**
347  * Returns a string representing the type of a variable.
348  * @param {*} value
349  * @return {string}
350  */
351 createjs.typeOf = function(value) {
352   /// <param name="value"/>
353   /// <returns type="string"/>
354   return typeof value;
355 };
356 
357 /**
358  * Returns true if the specified variable is a string primitive.
359  * @param {*} value
360  * @return {boolean}
361  */
362 createjs.isString = function(value) {
363   /// <param name="value"/>
364   /// <returns type="boolean"/>
365   return createjs.typeOf(value) == 'string';
366 };
367 
368 /**
369  * Returns true if the specified variable is a string primitive.
370  * @param {*} value
371  * @return {boolean}
372  */
373 createjs.isNumber = function(value) {
374   /// <param name="value"/>
375   /// <returns type="boolean"/>
376   return createjs.typeOf(value) == 'number';
377 };
378 
379 /**
380  * Returns true if the specified variable is a string primitive.
381  * @param {*} value
382  * @return {boolean}
383  */
384 createjs.isBoolean = function(value) {
385   /// <param name="value"/>
386   /// <returns type="boolean"/>
387   return createjs.typeOf(value) == 'boolean';
388 };
389 
390 /**
391  * Returns true if the specified variable is not undefined, i.e. the variable is
392  * a defined one.
393  * @param {*} value
394  * @return {boolean}
395  */
396 createjs.isDefined = function(value) {
397   /// <param name="value"/>
398   /// <returns type="boolean"/>
399   return createjs.typeOf(value) != 'undefined';
400 };
401 
402 /**
403  * Returns true if the specified variable is a Function object.
404  * @param {*} value
405  * @return {boolean}
406  */
407 createjs.isFunction = function(value) {
408   /// <param name="value"/>
409   /// <returns type="boolean"/>
410   return createjs.typeOf(value) == 'function';
411 };
412 
413 /**
414  * Returns true if the specified variable is an Object variable.
415  * @param {*} value
416  * @return {boolean}
417  */
418 createjs.isObject = function(value) {
419   /// <param name="value"/>
420   /// <returns type="boolean"/>
421   return createjs.typeOf(value) == 'object';
422 };
423 
424 /**
425  * Returns true if the specified variable is an Array object.
426  * @param {*} value
427  * @return {boolean}
428  */
429 createjs.isArray = function(value) {
430   /// <param name="value"/>
431   /// <returns type="boolean"/>
432   return value instanceof Array;
433 };
434 
435 /**
436  * Returns true if the specified variable is NaN. NaN does not become equal to
437  * anything, including NaN itself. This method uses this property to check if
438  * the specified value is NaN. (This method returns false if the 'value'
439  * parameter is undefined, i.e. this method is not completely equivalent to the
440  * isNaN() method.)
441  * @param {*} value
442  * @return {boolean}
443  */
444 createjs.isNaN = function(value) {
445   /// <param name="value"/>
446   /// <returns type="boolean"/>
447   return value !== value;
448 };
449 
450 /**
451  * Changes the type of the specified variable to string.
452  * @param {*} value
453  * @return {string}
454  */
455 createjs.castString = function(value) {
456   /// <param name="value"/>
457   /// <returns type="string"/>
458   return /** @type {string} */ (value);
459 };
460 
461 /**
462  * Changes the type of the specified variable to number. This function does not
463  * actually converts a string to a number, i.e. 'createjs.castNumber("0") + 1'
464  * returns a string "01" instead of returning a number 1. (In terms of C++, this
465  * function is similar to 'reinterpret_cast<TYPE>'.)
466  * @param {*} value
467  * @return {number}
468  */
469 createjs.castNumber = function(value) {
470   /// <param name="value"/>
471   /// <returns type="number"/>
472   return /** @type {number} */ (value);
473 };
474 
475 /**
476  * Changes the type of the specified variable to boolean.
477  * @param {*} value
478  * @return {boolean}
479  */
480 createjs.castBoolean = function(value) {
481   /// <param name="value"/>
482   /// <returns type="boolean"/>
483   return /** @type {boolean} */ (value);
484 };
485 
486 /**
487  * Changes the type of the specified variable to Function.
488  * @param {*} value
489  * @return {Function}
490  */
491 createjs.castFunction = function(value) {
492   /// <param name="value"/>
493   /// <returns type="Function"/>
494   return /** @type {Function} */ (value);
495 };
496 
497 /**
498  * Changes the type of the specified variable to Object.
499  * @param {*} value
500  * @return {Object}
501  */
502 createjs.castObject = function(value) {
503   /// <param name="value"/>
504   /// <returns type="Object"/>
505   return /** @type {Object} */ (value);
506 };
507 
508 /**
509  * Changes the type of the specified variable to Array.
510  * @param {*} value
511  * @return {Array}
512  */
513 createjs.castArray = function(value) {
514   /// <param name="value"/>
515   /// <returns type="Array"/>
516   return /** @type {Array} */ (value);
517 };
518 
519 /**
520  * Changes the type of the specified variable to ArrayBuffer.
521  * @param {*} value
522  * @return {ArrayBuffer}
523  */
524 createjs.castArrayBuffer = function(value) {
525   /// <param name="value"/>
526   /// <returns type="ArrayBuffer"/>
527   return /** @type {ArrayBuffer} */ (value);
528 };
529 
530 /**
531  * Changes the type of the specified variable to number only if it is a number.
532  * @param {*} value
533  * @return {string}
534  */
535 createjs.getString = function(value) {
536   /// <param name="value"/>
537   /// <returns type="string"/>
538   if (createjs.DEBUG && !createjs.isString(value)) {
539     createjs.error('value is not a string.');
540   }
541   return createjs.castString(value);
542 };
543 
544 /**
545  * Changes the type of the specified variable to number only if it is a number.
546  * @param {*} value
547  * @return {number}
548  */
549 createjs.getNumber = function(value) {
550   /// <param name="value"/>
551   /// <returns type="number"/>
552   if (createjs.DEBUG && !createjs.isNumber(value)) {
553     createjs.error('value is not a number.');
554   }
555   return createjs.castNumber(value);
556 };
557 
558 /**
559  * Changes the type of the specified variable to boolean only if it is a boolean
560  * variable.
561  * @param {*} value
562  * @return {boolean}
563  */
564 createjs.getBoolean = function(value) {
565   /// <param name="value"/>
566   /// <returns type="boolean"/>
567   if (createjs.DEBUG && !createjs.isBoolean(value)) {
568     createjs.error('value is not a boolean.');
569   }
570   return createjs.castBoolean(value);
571 };
572 
573 /**
574  * Changes the type of the specified variable to Function only if it is a
575  * Function.
576  * @param {*} value
577  * @return {Function}
578  */
579 createjs.getFunction = function(value) {
580   /// <param name="value"/>
581   /// <returns type="Function"/>
582   if (createjs.DEBUG && !createjs.isFunction(value)) {
583     createjs.error('value is not a Function.');
584   }
585   return createjs.castFunction(value);
586 };
587 
588 /**
589  * Changes the type of the specified variable to Object only if it is an Object.
590  * @param {*} value
591  * @return {Object}
592  */
593 createjs.getObject = function(value) {
594   /// <param name="value"/>
595   /// <returns type="Object"/>
596   if (createjs.DEBUG && !createjs.isObject(value)) {
597     createjs.error('value is not an Object.');
598   }
599   return createjs.castObject(value);
600 };
601 
602 /**
603  * Changes the type of the specified variable to Array only if it is an Array.
604  * @param {*} value
605  * @return {Array}
606  */
607 createjs.getArray = function(value) {
608   /// <param name="value"/>
609   /// <returns type="Array"/>
610   if (createjs.DEBUG && !createjs.isArray(value)) {
611     createjs.error('value is not an Array.');
612   }
613   return createjs.castArray(value);
614 };
615 
616 /**
617  * Converts a string variable and returns a signed integer. This function always
618  * returns a signed number object to which we can apply arithmetic operations to
619  * it, i.e. 'org.aegis.parseInt("0") + 1' returns a number 1.
620  * @param {*} value
621  * @return {number}
622  */
623 createjs.parseInt = function(value) {
624   /// <param name="value"/>
625   /// <returns type="number"/>
626   if (createjs.DEBUG &&
627       !createjs.isNumber(value) && !createjs.isString(value)) {
628     createjs.error('value is not a number.');
629   }
630   return createjs.castNumber(value) | 0;
631 };
632 
633 /**
634  * Converts a string variable and returns a floating-point number.
635  * @param {*} value
636  * @return {number}
637  */
638 createjs.parseFloat = function(value) {
639   /// <param name="value"/>
640   /// <returns type="number"/>
641   if (createjs.DEBUG &&
642       !createjs.isNumber(value) && !createjs.isString(value)) {
643     createjs.error('value is not a number.');
644   }
645   return createjs.castNumber(value) * 1;
646 };
647 
648 /**
649  * Converts a string primitive from a primitive variable.
650  * @param {*} value
651  * @return {string}
652  */
653 createjs.parseString = function(value) {
654   /// <param name="value"/>
655   /// <returns type="string"/>
656   if (createjs.DEBUG && createjs.isObject(value)) {
657     createjs.error('value is not a primitive.');
658   }
659   return createjs.castString(value) + '';
660 };
661 
662 /**
663  * Truncates the specified value. This method discards the fractional part of
664  * the specified number and returns only its integral part.
665  * @param {number} n
666  * @return {number}
667  */
668 createjs.truncate = function(n) {
669   /// <param type="number" name="n"/>
670   /// <returns type="number"/>
671   return n | 0;
672 };
673 
674 /**
675  * Returns the largest integer less than or equal to the specified number.
676  * @param {number} n
677  * @return {number}
678  */
679 createjs.floor = function(n) {
680   /// <param type="number" name="n"/>
681   /// <returns type="number"/>
682   createjs.assert(0 <= n && n < (1 << 30));
683   return createjs.truncate(n);
684 };
685 
686 /**
687  * Returns the smallest integer greater than or equal to the specified number.
688  * @param {number} n
689  * @return {number}
690  */
691 createjs.ceil = function(n) {
692   /// <param type="number" name="n"/>
693   /// <returns type="number"/>
694   var floor = createjs.floor(n);
695   return (floor == n) ? n : floor + 1;
696 };
697 
698 /**
699  * Returns the nearest integer of the specified number.
700  * @param {number} n
701  * @return {number}
702  */
703 createjs.round = function(n) {
704   /// <param type="number" name="n"/>
705   /// <returns type="number"/>
706   return createjs.floor(n + 0.5);
707 };
708 
709 /**
710  * Returns the absolute value of the specified number.
711  * @param {number} n
712  * @return {number}
713  */
714 createjs.abs = function(n) {
715   /// <param type="number" name="n"/>
716   /// <returns type="number"/>
717   return n > 0 ? n : -n;
718 };
719 
720 /**
721  * Returns the minimum value.
722  * @param {number} n0
723  * @param {number} n1
724  * @return {number}
725  */
726 createjs.min = function(n0, n1) {
727   /// <param type="number" name="n0"/>
728   /// <param type="number" name="n1"/>
729   /// <returns type="number"/>
730   return n0 < n1 ? n0 : n1;
731 };
732 
733 /**
734  * Returns the maximum value.
735  * @param {number} n0
736  * @param {number} n1
737  * @return {number}
738  */
739 createjs.max = function(n0, n1) {
740   /// <param type="number" name="n0"/>
741   /// <param type="number" name="n1"/>
742   /// <returns type="number"/>
743   return n0 > n1 ? n0 : n1;
744 };
745 
746 /**
747  * Returns an approximate value of the Math.sin() method.
748  * @param {number} angle
749  * @return {number}
750  */
751 createjs.sin = function(angle) {
752   /// <param type="number" name="angle"/>
753   /// <returns type="number"/>
754   var M_PI_180 = 0.017453292519943295;  // Math.PI / 180;
755   return Math.sin(angle * M_PI_180);
756 };
757 
758 /**
759  * Returns an approximate value of the Math.cos() method.
760  * @param {number} angle
761  * @return {number}
762  */
763 createjs.cos = function(angle) {
764   /// <param type="number" name="angle"/>
765   /// <returns type="number"/>
766   var M_PI_180 = 0.017453292519943295;  // Math.PI / 180;
767   return Math.cos(angle * M_PI_180);
768 };
769 
770 /**
771  * Returns an approximate value of the arctangent of y / x in degrees. This
772  * method does not normalize the output angle to a range [-180,180].
773  * @param {number} y
774  * @param {number} x
775  * @return {number}
776  */
777 createjs.atan2 = function(y, x) {
778   /// <param type="number" name="y"/>
779   /// <param type="number" name="x"/>
780   /// <returns type="number"/>
781   var M_180_PI = 57.29577951308232;  // 180 / Math.PI;
782   return Math.atan2(y, x) * M_180_PI;
783 };
784 
785 /**
786  * Changes the type of the specified variable to HTMLCanvasElement.
787  * @param {*} value
788  * @return {HTMLCanvasElement}
789  */
790 createjs.castCanvas = function(value) {
791   /// <param name="value"/>
792   /// <returns type="HTMLCanvasElement"/>
793   return /** @type {HTMLCanvasElement} */ (value);
794 };
795 
796 /**
797  * Creates a <canvas> element.
798  * @return {HTMLCanvasElement}
799  */
800 createjs.createCanvas = function() {
801   /// <returns type="HTMLCanvasElement"/>
802   return createjs.castCanvas(document.createElement('canvas'));
803 };
804 
805 /**
806  * Returns the rendering context associated with a <canvas> element.
807  * @param {HTMLCanvasElement} canvas
808  * @return {CanvasRenderingContext2D}
809  */
810 createjs.getRenderingContext2D = function(canvas) {
811   /// <param type="HTMLCanvasElement" name="canvas"/>
812   /// <returns type="CanvasRenderingContext2D"/>
813   return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d'));
814 };
815 
816 /**
817  * Creates an <img> element.
818  * @return {HTMLImageElement}
819  */
820 createjs.createImage = function() {
821   /// <returns type="HTMLImageElement"/>
822   return /** @type {HTMLImageElement} */ (document.createElement('img'));
823 };
824 
825 /**
826  * Returns the origin of the current location.
827  * @return {string}
828  */
829 createjs.getOrigin = function() {
830   /// <returns type="string"/>
831   return createjs.origin_;
832 };
833 
834 if (!createjs.SUPPORT_AMD) {
835   // Export a couple of variables to the global namespace.
836   createjs.exportStatic('createjs', {
837     'version':
838         '0.' + createjs.MAJOR_VERSION + '.' + createjs.MINOR_VERSION,
839     'denaVersion':
840         (createjs.DENA_MAJOR_VERSION << 16) + createjs.DENA_MINOR_VERSION
841   });
842 }
843