Skip to content

Commit

Permalink
add remove event listener so when using event source streams can be p…
Browse files Browse the repository at this point in the history
…roperly closed
  • Loading branch information
Pirolf authored and rexxars committed Apr 17, 2017
1 parent ef27552 commit cb532e7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/eventsource.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ EventSource.prototype.addEventListener = function addEventListener(method, liste
}
};

EventSource.prototype.removeEventListener = function removeEventListener(method, listener) {
if (typeof listener === 'function') {
listener._listener = undefined;
this.off(method, listener);
}
};

/**
* W3C Event
*
Expand Down

0 comments on commit cb532e7

Please sign in to comment.