Add on/off/trigger syntax

This commit is contained in:
Chad Engler 2013-04-02 08:44:58 -04:00
parent 3a29735b33
commit 8ebcc96c77

View file

@ -7,7 +7,7 @@ PIXI.EventTarget = function () {
var listeners = {}; var listeners = {};
this.addEventListener = function ( type, listener ) { this.addEventListener = this.on = function ( type, listener ) {
if ( listeners[ type ] === undefined ) { if ( listeners[ type ] === undefined ) {
@ -23,7 +23,7 @@ PIXI.EventTarget = function () {
}; };
this.dispatchEvent = function ( event ) { this.dispatchEvent = this.trigger = function ( event ) {
for ( var listener in listeners[ event.type ] ) { for ( var listener in listeners[ event.type ] ) {
@ -33,7 +33,7 @@ PIXI.EventTarget = function () {
}; };
this.removeEventListener = function ( type, listener ) { this.removeEventListener = this.off = function ( type, listener ) {
var index = listeners[ type ].indexOf( listener ); var index = listeners[ type ].indexOf( listener );