Skip to content

Commit

Permalink
Two more tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas committed Nov 5, 2010
1 parent 3c7861a commit 1cd7c42
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/gallery-eventsource/js/eventsource.js
Expand Up @@ -166,7 +166,7 @@
}

//means content type is correct, keep going
that._updateReadyState();
that._signalOpen();

//IE6 and IE7 throw an error when trying to access responseText here
try {
Expand All @@ -175,7 +175,7 @@
//noop
}
} else if (src.readyState == 4 && that.readyState < 2){
that._updateReadyState();
that._signalOpen();
that._validateResponse();
}
};
Expand All @@ -184,8 +184,11 @@

//wait until this JS task is done before firing
//so as not to lose any events
setTimeout(Y.bind(function(){
this._transport.send(null);
setTimeout(Y.bind(function(){
//close() might have been called before this executes
if (this.readyState != 2){
this._transport.send(null);
}
},this), 0);
},

Expand Down Expand Up @@ -222,14 +225,15 @@

/**
* Updates the readyState property to 1 if it's still
* set at 0.
* @method _updateReadyState
* set at 0 and fires the open event.
* @method _signalOpen
* @return {void}
* @private
*/
_updateReadyState: function(){
_signalOpen: function(){
if (this.readyState == 0){
this.readyState == 1;
this.readyState = 1;
this.fire({type:"open"});
}
},

Expand Down

0 comments on commit 1cd7c42

Please sign in to comment.