Skip to content

Commit

Permalink
Removed redundant functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas committed Oct 22, 2010
1 parent 8ceca4b commit 72a6c9c
Showing 1 changed file with 1 addition and 66 deletions.
67 changes: 1 addition & 66 deletions javascript/src/core/TestRunner.js
Expand Up @@ -249,72 +249,7 @@
* @event begin
* @static
*/
BEGIN_EVENT : "begin",

//-------------------------------------------------------------------------
// 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 subscribe
*/
subscribe: function(type, listener){
if (typeof this._handlers[type] == "undefined"){
this._handlers[type] = [];
}

this._handlers[type].push(listener);
},

/**
* 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
*/
fire: function(event){
if (typeof event == "string"){
event = { type: event };
}
if (!event.target){
event.target = this;
}

if (!event.type){
throw new Error("Event object missing 'type' property.");
}

if (this._handlers[event.type] instanceof Array){
var handlers = this._handlers[event.type];
for (var i=0, len=handlers.length; i < len; i++){
handlers[i].call(this, event);
}
}
},

/**
* 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
*/
unsubscribe: function(type, listener){
if (this._handlers[type] instanceof Array){
var handlers = this._handlers[type];
for (var i=0, len=handlers.length; i < len; i++){
if (handlers[i] === listener){
handlers.splice(i, 1);
break;
}
}
}
},
BEGIN_EVENT : "begin",

//-------------------------------------------------------------------------
// Test Tree-Related Methods
Expand Down

0 comments on commit 72a6c9c

Please sign in to comment.