Skip to content

Commit

Permalink
another IE11 fix: avoid Array.prototype.findIndex
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Hiller <[email protected]>
  • Loading branch information
boneskull committed May 14, 2020
1 parent 5277a9f commit 885b525
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,18 @@ Runner.prototype._addEventListener = function(target, eventName, listener) {
* @param fn {function}
*/
Runner.prototype._removeEventListener = function(target, eventName, listener) {
var eventListenerIndex = this._eventListeners.findIndex(function(
eventListenerDescriptor
) {
return (
var eventListenerIndex = -1;
for (var i = 0; i < this._eventListeners.length; i++) {
var eventListenerDescriptor = this._eventListeners[i];
if (
eventListenerDescriptor[0] === target &&
eventListenerDescriptor[1] === eventName &&
eventListenerDescriptor[2] === listener
);
});
) {
eventListenerIndex = i;
break;
}
}
if (eventListenerIndex !== -1) {
var removedListener = this._eventListeners.splice(eventListenerIndex, 1)[0];
removedListener[0].removeListener(removedListener[1], removedListener[2]);
Expand Down

0 comments on commit 885b525

Please sign in to comment.