ng-event-source
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -171,2 +171,3 @@ /** @license | ||
var timeout0 = 0; | ||
var timeoutConnection = 0; | ||
var charOffset = 0; | ||
@@ -201,2 +202,6 @@ var currentState = WAITING; | ||
} | ||
if (timeoutConnection !== 0) { | ||
clearTimeout(timeoutConnection); | ||
timeoutConnection = 0; | ||
} | ||
that.readyState = CLOSED; | ||
@@ -477,2 +482,10 @@ } | ||
timeout = setTimeout(onTimeout, heartbeatTimeout); | ||
timeoutConnection = setTimeout(function() { | ||
if (xhr.status === 0) { | ||
xhr.timeout = 1; | ||
if (errorOnTimeout) { | ||
console.log('No ack received'); | ||
} | ||
} | ||
}, connectionTimeout); | ||
@@ -494,13 +507,5 @@ charOffset = 0; | ||
} | ||
xhr.timeout = 0; | ||
xhr.open("GET", s, true); | ||
if (connectionTimeout > 0) { | ||
xhr.timeout = connectionTimeout; | ||
xhr.ontimeout = function (e) { | ||
if (errorOnTimeout) { | ||
throw new Error("No ack received"); | ||
} | ||
} | ||
} | ||
if ("withCredentials" in xhr) { | ||
@@ -507,0 +512,0 @@ // withCredentials should be set after "open" for Safari and Chrome (< 19 ?) |
{ | ||
"name": "ng-event-source", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"main": "eventsource.js", | ||
@@ -5,0 +5,0 @@ "typings": "typings.d.ts", |
Sorry, the diff of this file is not supported yet
177680
3934