@@ -410,62 +410,6 @@ this.createjs = this.createjs||{};
410410( function ( ) {
411411 "use strict" ;
412412
413-
414- // constructor:
415- /**
416- * EventDispatcher provides methods for managing queues of event listeners and dispatching events.
417- *
418- * You can either extend EventDispatcher or mix its methods into an existing prototype or instance by using the
419- * EventDispatcher {{#crossLink "EventDispatcher/initialize"}}{{/crossLink}} method.
420- *
421- * Together with the CreateJS Event class, EventDispatcher provides an extended event model that is based on the
422- * DOM Level 2 event model, including addEventListener, removeEventListener, and dispatchEvent. It supports
423- * bubbling / capture, preventDefault, stopPropagation, stopImmediatePropagation, and handleEvent.
424- *
425- * EventDispatcher also exposes a {{#crossLink "EventDispatcher/on"}}{{/crossLink}} method, which makes it easier
426- * to create scoped listeners, listeners that only run once, and listeners with associated arbitrary data. The
427- * {{#crossLink "EventDispatcher/off"}}{{/crossLink}} method is merely an alias to
428- * {{#crossLink "EventDispatcher/removeEventListener"}}{{/crossLink}}.
429- *
430- * Another addition to the DOM Level 2 model is the {{#crossLink "EventDispatcher/removeAllEventListeners"}}{{/crossLink}}
431- * method, which can be used to listeners for all events, or listeners for a specific event. The Event object also
432- * includes a {{#crossLink "Event/remove"}}{{/crossLink}} method which removes the active listener.
433- *
434- * <h4>Example</h4>
435- * Add EventDispatcher capabilities to the "MyClass" class.
436- *
437- * EventDispatcher.initialize(MyClass.prototype);
438- *
439- * Add an event (see {{#crossLink "EventDispatcher/addEventListener"}}{{/crossLink}}).
440- *
441- * instance.addEventListener("eventName", handlerMethod);
442- * function handlerMethod(event) {
443- * console.log(event.target + " Was Clicked");
444- * }
445- *
446- * <b>Maintaining proper scope</b><br />
447- * Scope (ie. "this") can be be a challenge with events. Using the {{#crossLink "EventDispatcher/on"}}{{/crossLink}}
448- * method to subscribe to events simplifies this.
449- *
450- * instance.addEventListener("click", function(event) {
451- * console.log(instance == this); // false, scope is ambiguous.
452- * });
453- *
454- * instance.on("click", function(event) {
455- * console.log(instance == this); // true, "on" uses dispatcher scope by default.
456- * });
457- *
458- * If you want to use addEventListener instead, you may want to use function.bind() or a similar proxy to manage
459- * scope.
460- *
461- * <b>Browser support</b>
462- * The event model in CreateJS can be used separately from the suite in any project, however the inheritance model
463- * requires modern browsers (IE9+).
464- *
465- *
466- * @class EventDispatcher
467- * @constructor
468- **/
469413 function EventDispatcher ( ) {
470414
471415
@@ -501,12 +445,9 @@ this.createjs = this.createjs||{};
501445 EventDispatcher . initialize = function ( target ) {
502446 target . addEventListener = p . addEventListener ;
503447 target . on = p . on ;
504- target . removeEventListener = target . off = p . removeEventListener ;
505- target . removeAllEventListeners = p . removeAllEventListeners ;
506448 target . hasEventListener = p . hasEventListener ;
507449 target . dispatchEvent = p . dispatchEvent ;
508450 target . _dispatchEvent = p . _dispatchEvent ;
509- target . willTrigger = p . willTrigger ;
510451 } ;
511452
512453
@@ -537,7 +478,6 @@ this.createjs = this.createjs||{};
537478 listeners = this . _listeners = this . _listeners || { } ;
538479 }
539480 var arr = listeners [ type ] ;
540- if ( arr ) { this . removeEventListener ( type , listener , useCapture ) ; }
541481 arr = listeners [ type ] ; // remove may have deleted the array
542482 if ( ! arr ) { listeners [ type ] = [ listener ] ; }
543483 else { arr . push ( listener ) ; }
@@ -548,9 +488,6 @@ this.createjs = this.createjs||{};
548488 * A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener
549489 * only run once, associate arbitrary data with the listener, and remove the listener.
550490 *
551- * This method works by creating an anonymous wrapper function and subscribing it with addEventListener.
552- * The wrapper function is returned for use with `removeEventListener` (or `off`).
553- *
554491 * <b>IMPORTANT:</b> To remove a listener added with `on`, you must pass in the returned wrapper function as the listener, or use
555492 * {{#crossLink "Event/remove"}}{{/crossLink}}. Likewise, each time you call `on` a NEW wrapper function is subscribed, so multiple calls
556493 * to `on` with the same params will create multiple listeners.
@@ -576,7 +513,6 @@ this.createjs = this.createjs||{};
576513 * @param {Boolean } [once=false] If true, the listener will remove itself after the first time it is triggered.
577514 * @param {* } [data] Arbitrary data that will be included as the second parameter when the listener is called.
578515 * @param {Boolean } [useCapture=false] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.
579- * @return {Function } Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener.
580516 **/
581517 p . on = function ( type , listener , scope , once , data , useCapture ) {
582518 if ( listener . handleEvent ) {
@@ -590,72 +526,6 @@ this.createjs = this.createjs||{};
590526 } , useCapture ) ;
591527 } ;
592528
593- /**
594- * Removes the specified event listener.
595- *
596- * <b>Important Note:</b> that you must pass the exact function reference used when the event was added. If a proxy
597- * function, or function closure is used as the callback, the proxy/closure reference must be used - a new proxy or
598- * closure will not work.
599- *
600- * <h4>Example</h4>
601- *
602- * displayObject.removeEventListener("click", handleClick);
603- *
604- * @method removeEventListener
605- * @param {String } type The string type of the event.
606- * @param {Function | Object } listener The listener function or object.
607- * @param {Boolean } [useCapture] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.
608- **/
609- p . removeEventListener = function ( type , listener , useCapture ) {
610- var listeners = useCapture ? this . _captureListeners : this . _listeners ;
611- if ( ! listeners ) { return ; }
612- var arr = listeners [ type ] ;
613- if ( ! arr ) { return ; }
614- for ( var i = 0 , l = arr . length ; i < l ; i ++ ) {
615- if ( arr [ i ] == listener ) {
616- if ( l == 1 ) { delete ( listeners [ type ] ) ; } // allows for faster checks.
617- else { arr . splice ( i , 1 ) ; }
618- break ;
619- }
620- }
621- } ;
622-
623- /**
624- * A shortcut to the removeEventListener method, with the same parameters and return value. This is a companion to the
625- * .on method.
626- *
627- * <b>IMPORTANT:</b> To remove a listener added with `on`, you must pass in the returned wrapper function as the listener. See
628- * {{#crossLink "EventDispatcher/on"}}{{/crossLink}} for an example.
629- *
630- * @method off
631- * @param {String } type The string type of the event.
632- * @param {Function | Object } listener The listener function or object.
633- * @param {Boolean } [useCapture] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.
634- **/
635- p . off = p . removeEventListener ;
636-
637- /**
638- * Removes all listeners for the specified type, or all listeners of all types.
639- *
640- * <h4>Example</h4>
641- *
642- * // Remove all listeners
643- * displayObject.removeAllEventListeners();
644- *
645- * // Remove all click listeners
646- * displayObject.removeAllEventListeners("click");
647- *
648- * @method removeAllEventListeners
649- * @param {String } [type] The string type of the event. If omitted, all listeners for all types will be removed.
650- **/
651- p . removeAllEventListeners = function ( type ) {
652- if ( ! type ) { this . _listeners = this . _captureListeners = null ; }
653- else {
654- if ( this . _listeners ) { delete ( this . _listeners [ type ] ) ; }
655- if ( this . _captureListeners ) { delete ( this . _captureListeners [ type ] ) ; }
656- }
657- } ;
658-
659529 /**
660530 * Dispatches the specified event to all listeners.
661531 *
@@ -721,35 +591,6 @@ this.createjs = this.createjs||{};
721591 return ! ! ( ( listeners && listeners [ type ] ) || ( captureListeners && captureListeners [ type ] ) ) ;
722592 } ;
723593
724- /**
725- * Indicates whether there is at least one listener for the specified event type on this object or any of its
726- * ancestors (parent, parent's parent, etc). A return value of true indicates that if a bubbling event of the
727- * specified type is dispatched from this object, it will trigger at least one listener.
728- *
729- * This is similar to {{#crossLink "EventDispatcher/hasEventListener"}}{{/crossLink}}, but it searches the entire
730- * event flow for a listener, not just this object.
731- * @method willTrigger
732- * @param {String } type The string type of the event.
733- * @return {Boolean } Returns `true` if there is at least one listener for the specified event.
734- **/
735- p . willTrigger = function ( type ) {
736- var o = this ;
737- while ( o ) {
738- if ( o . hasEventListener ( type ) ) { return true ; }
739- o = o . parent ;
740- }
741- return false ;
742- } ;
743-
744- /**
745- * @method toString
746- * @return {String } a string representation of the instance.
747- **/
748- p . toString = function ( ) {
749- return "[EventDispatcher]" ;
750- } ;
751-
752-
753594// private methods:
754595 /**
755596 * @method _dispatchEvent
@@ -1757,26 +1598,6 @@ this.createjs = this.createjs || {};
17571598 return raw ? this . _rawResult : this . _result ;
17581599 } ;
17591600
1760- /**
1761- * Return the `tag` this object creates or uses for loading.
1762- * @method getTag
1763- * @return {Object } The tag instance
1764- * @since 0.6.0
1765- */
1766- p . getTag = function ( ) {
1767- return this . _tag ;
1768- } ;
1769-
1770- /**
1771- * Set the `tag` this item uses for loading.
1772- * @method setTag
1773- * @param {Object } tag The tag instance
1774- * @since 0.6.0
1775- */
1776- p . setTag = function ( tag ) {
1777- this . _tag = tag ;
1778- } ;
1779-
17801601 /**
17811602 * Begin loading the item. This method is required when using a loader by itself.
17821603 *
@@ -1806,37 +1627,6 @@ this.createjs = this.createjs || {};
18061627 this . _request . load ( ) ;
18071628 } ;
18081629
1809- /**
1810- * Close the the item. This will stop any open requests (although downloads using HTML tags may still continue in
1811- * the background), but events will not longer be dispatched.
1812- * @method cancel
1813- */
1814- p . cancel = function ( ) {
1815- this . canceled = true ;
1816- this . destroy ( ) ;
1817- } ;
1818-
1819- /**
1820- * Clean up the loader.
1821- * @method destroy
1822- */
1823- p . destroy = function ( ) {
1824- if ( this . _request ) {
1825- this . _request . removeAllEventListeners ( ) ;
1826- this . _request . destroy ( ) ;
1827- }
1828-
1829- this . _request = null ;
1830-
1831- this . _item = null ;
1832- this . _rawResult = null ;
1833- this . _result = null ;
1834-
1835- this . _loadItems = null ;
1836-
1837- this . removeAllEventListeners ( ) ;
1838- } ;
1839-
18401630 /**
18411631 * Get any items loaded internally by the loader. The enables loaders such as {{#crossLink "ManifestLoader"}}{{/crossLink}}
18421632 * to expose items it loads internally.
@@ -2126,25 +1916,6 @@ this.createjs = this.createjs || {};
21261916 }
21271917 } ;
21281918
2129- /**
2130- * The result formatter for media files.
2131- * @method _formatResult
2132- * @param {AbstractLoader } loader
2133- * @returns {HTMLVideoElement|HTMLAudioElement }
2134- * @private
2135- */
2136- p . _formatResult = function ( loader ) {
2137- this . _tag . removeEventListener && this . _tag . removeEventListener ( "canplaythrough" , this . _loadedHandler ) ;
2138- this . _tag . onstalled = null ;
2139- if ( this . _preferXHR ) {
2140- var URL = window . URL || window . webkitURL ;
2141- var result = loader . getResult ( true ) ;
2142-
2143- loader . getTag ( ) . src = URL . createObjectURL ( result ) ;
2144- }
2145- return loader . getTag ( ) ;
2146- } ;
2147-
21481919 createjs . AbstractMediaLoader = createjs . promote ( AbstractMediaLoader , "AbstractLoader" ) ;
21491920
21501921} ( ) ) ;
@@ -3843,14 +3614,6 @@ this.createjs = this.createjs || {};
38433614 */
38443615 p . _processFinishedLoad = function ( item , loader ) {
38453616 this . _numItemsLoaded ++ ;
3846-
3847- // Since LoadQueue needs maintain order, we can't append scripts in the loader.
3848- // So we do it here instead. Or in _checkScriptLoadOrder();
3849- if ( ! this . maintainScriptOrder && item . type == createjs . Types . JAVASCRIPT ) {
3850- var tag = loader . getTag ( ) ;
3851- createjs . DomUtils . appendToHead ( tag ) ;
3852- }
3853-
38543617 this . _updateProgress ( ) ;
38553618 this . _sendFileComplete ( item , loader ) ;
38563619 this . _loadNext ( ) ;
0 commit comments