Skip to content

Commit

Permalink
Log serviceWorker error message if any
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Dec 3, 2020
1 parent c766432 commit a57aaa3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lhc_web/design/defaulttheme/js/widgetv2/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lhc_web/design/defaulttheme/js/widgetv2/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lhc_web/design/defaulttheme/widget/wrapper/dist/index.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions lhc_web/design/defaulttheme/widget/wrapper/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,21 +737,25 @@
if (serviceWorkerAvailable === true) {
try {
navigator.serviceWorker.addEventListener('message', function (event) {
if (typeof event.data.lhc_ch !== 'undefined' && typeof event.data.lhc_cid !== 'undefined') {
attributesWidget.widgetStatus.next(true);
if (attributesWidget.mode == 'popup') {
attributesWidget.userSession.setChatInformation({
'id': event.data.lhc_cid,
'hash': event.data.lhc_ch
});
attributesWidget.eventEmitter.emitEvent('unread_message');
} else {
chatEvents.sendChildEvent('shownWidget', [{'sender': 'closeButton'}]);
chatEvents.sendChildEvent('reopenNotification', [{
'id': event.data.lhc_cid,
'hash': event.data.lhc_ch
}]);
try {
if (typeof event.data.lhc_ch !== 'undefined' && typeof event.data.lhc_cid !== 'undefined') {
attributesWidget.widgetStatus.next(true);
if (attributesWidget.mode == 'popup') {
attributesWidget.userSession.setChatInformation({
'id': event.data.lhc_cid,
'hash': event.data.lhc_ch
});
attributesWidget.eventEmitter.emitEvent('unread_message');
} else {
chatEvents.sendChildEvent('shownWidget', [{'sender': 'closeButton'}]);
chatEvents.sendChildEvent('reopenNotification', [{
'id': event.data.lhc_cid,
'hash': event.data.lhc_ch
}]);
}
}
} catch (e) {
if (lhcError) lhcError.log(e.message, "index.js", e.lineNumber || e.line, e.stack); else throw Error("lhc : " + e.message);
}
});
} catch (e) {
Expand Down

0 comments on commit a57aaa3

Please sign in to comment.