Adds a check and reuses any previous onerror handlers if they exist.

This commit is contained in:
damencho 2016-04-06 11:52:31 -05:00
parent e56c936798
commit ccc9f4e033
1 changed files with 12 additions and 2 deletions

View File

@ -316,8 +316,18 @@ export default {
this.roomName = options.roomName;
JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.TRACE);
// attaches global error handler
window.onerror = JitsiMeetJS.getGlobalOnErrorHandler;
// attaches global error handler, if there is already one, respect it
if(JitsiMeetJS.getGlobalOnErrorHandler){
var oldOnErrorHandler = window.onerror;
window.onerror = function (message, source, lineno, colno, error) {
JitsiMeetJS.getGlobalOnErrorHandler(
message, source, lineno, colno, error);
if(oldOnErrorHandler)
oldOnErrorHandler(message, source, lineno, colno, error);
};
}
return JitsiMeetJS.init(config).then(() => {
return Promise.all([