#

API Docs for: 1.0
Show: Inherited Protected Private Deprecated

# File: pixi/utils/EventTarget.js

    /**
     * https://github.com/mrdoob/eventtarget.js/
     * THankS mr DOob!
     */

    PIXI.EventTarget = function () {

    	var listeners = {};

    	this.addEventListener = function ( type, listener ) {

    		if ( listeners[ type ] === undefined ) {

    			listeners[ type ] = [];

    		}

    		if ( listeners[ type ].indexOf( listener ) === - 1 ) {

    			listeners[ type ].push( listener );
    		}

    	};

    	this.dispatchEvent = function ( event ) {

    		for ( var listener in listeners[ event.type ] ) {

    			listeners[ event.type ][ listener ]( event );

    		}

    	};

    	this.removeEventListener = function ( type, listener ) {

    		var index = listeners[ type ].indexOf( listener );

    		if ( index !== - 1 ) {

    			listeners[ type ].splice( index, 1 );

    		}

    	};

    };