ng-event-source
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -154,3 +154,6 @@ /** @license | ||
var heartbeatTimeout = getDuration(options.heartbeatTimeout || 45000, 0); | ||
var checkActivity = true; | ||
if (options && options.checkActivity != null) { | ||
checkActivity = Boolean(options.checkActivity); | ||
} | ||
var lastEventId = ""; | ||
@@ -354,7 +357,7 @@ var headers = (options && options.headers) || {}; | ||
if ((currentState === OPEN || currentState === CONNECTING) && | ||
(type === "load" || type === "error" || isWrongStatusCodeOrContentType || (charOffset > 1024 * 1024) || (timeout === 0 && !wasActivity))) { | ||
(type === "load" || type === "error" || isWrongStatusCodeOrContentType || (charOffset > 1024 * 1024) || (timeout === 0 && (!wasActivity || !checkActivity)))) { | ||
if (isWrongStatusCodeOrContentType) { | ||
close(); | ||
} else { | ||
if (type === "" && timeout === 0 && !wasActivity) { | ||
if (type === "" && timeout === 0 && (!wasActivity || !checkActivity)) { | ||
setTimeout(function () { | ||
@@ -361,0 +364,0 @@ if (errorOnTimeout) { |
{ | ||
"name": "ng-event-source", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"main": "eventsource.js", | ||
@@ -5,0 +5,0 @@ "typings": "typings.d.ts", |
declare enum ReadyState {CONNECTING = 0, OPEN = 1, CLOSED = 2} | ||
export class EventSourcePolyfill extends EventTarget { | ||
CONNECTING: ReadyState; | ||
OPEN: ReadyState; | ||
CLOSED: ReadyState; | ||
CONNECTING: ReadyState; | ||
OPEN: ReadyState; | ||
CLOSED: ReadyState; | ||
constructor(url: string, eventSourceInitDict?: EventSourceInit); | ||
url: string; | ||
readyState: ReadyState; | ||
onopen: Function; | ||
onmessage: (event: OnMessageEvent) => void; | ||
onerror: Function; | ||
close: () => void; | ||
constructor(url: string, eventSourceInitDict?: EventSourceInit); | ||
url: string; | ||
readyState: ReadyState; | ||
onopen: Function; | ||
onmessage: (event: OnMessageEvent) => void; | ||
onerror: Function; | ||
close: () => void; | ||
} | ||
interface EventSourceInit { | ||
withCredentials?: boolean; | ||
headers?: Object; | ||
errorOnTimeout?: boolean; | ||
withCredentials?: boolean; | ||
headers?: Object; | ||
errorOnTimeout?: boolean; | ||
heartbeatTimeout?: number; | ||
checkActivity?: boolean; | ||
} | ||
interface OnMessageEvent { | ||
data: string; | ||
data: string; | ||
} |
Sorry, the diff of this file is not supported yet
172958
3915