Merge pull request #40 from englercj/event-aliases
Add on/off/trigger syntax
This commit is contained in:
commit
8a2051c8a2
1 changed files with 3 additions and 3 deletions
|
@ -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.emit = 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 );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue