EventTarget.js revision 625ac94d269a4ae4992b98f0cb3d66a32f1d41d0
/**
* Simple custom event implementation.
* @namespace Test
* @class EventTarget
* @constructor
*/
Test.EventTarget = function(){
/**
* Event handlers for the various events.
* @type Object
* @private
* @property _handlers
* @static
*/
this._handlers = {};
};
//restore prototype
//-------------------------------------------------------------------------
// Event Handling
//-------------------------------------------------------------------------
/**
* Adds a listener for a given event type.
* @param {String} type The type of event to add a listener for.
* @param {Function} listener The function to call when the event occurs.
* @return {void}
* @method attach
*/
}
},
/**
* Adds a listener for a given event type.
* @param {String} type The type of event to add a listener for.
* @param {Function} listener The function to call when the event occurs.
* @return {void}
* @method subscribe
* @deprecated
*/
},
/**
* Fires an event based on the passed-in object.
* @param {Object|String} event An object with at least a 'type' attribute
* or a string indicating the event name.
* @return {void}
* @method fire
*/
if (typeof event == "string"){
}
}
throw new Error("Event object missing 'type' property.");
}
}
}
},
/**
* Removes a listener for a given event type.
* @param {String} type The type of event to remove a listener from.
* @param {Function} listener The function to remove from the event.
* @return {void}
* @method detach
*/
break;
}
}
}
},
/**
* Removes a listener for a given event type.
* @param {String} type The type of event to remove a listener from.
* @param {Function} listener The function to remove from the event.
* @return {void}
* @method unsubscribe
* @deprecated
*/
}
};