Assume that addEventListener/removeEventListener are present in browsers

Jasmine 3.0 dropped support for the last browser that didn't support
the standard event handler methods (IE 9).
This commit is contained in:
Steve Gravrock
2022-08-20 10:27:44 -07:00
parent 79c6bbc189
commit f934e6d816
4 changed files with 66 additions and 56 deletions

View File

@@ -109,21 +109,14 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
}
};
if (global.addEventListener) {
global.addEventListener(
'unhandledrejection',
browserRejectionHandler
);
}
global.addEventListener('unhandledrejection', browserRejectionHandler);
this.uninstall = function uninstall() {
global.onerror = originalHandler;
if (global.removeEventListener) {
global.removeEventListener(
'unhandledrejection',
browserRejectionHandler
);
}
global.removeEventListener(
'unhandledrejection',
browserRejectionHandler
);
};
}
};