sguiheux / EventSource

EventSource "polyfill" with custom headers
20 stars 10 forks source link

onEvent processing when state is CLOSED #14

Closed akariv closed 6 years ago

akariv commented 6 years ago

Related to #12

Sometimes, after a close() call, more than one event will arrive.

The first will be handled by calling xhr.abort() and xhr=undefined. The second will skip that part and will fail on a TypeError: Cannot read property 'status' of undefined error.

We need to split the if clause to check first for CLOSED and later for null