Skip to content

Commit 08c7348

Browse files
authored
Merge pull request #42 from iMattPro/fixes
Service Worker Updater Fixes
2 parents 301ff6b + e9e96a8 commit 08c7348

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

styles/all/template/update_worker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ function webpushWorkerUpdate() {
1313
}
1414
}
1515
// Do not redeclare function if exist
16+
/* global domReady */
1617
if (typeof domReady === 'undefined') {
1718
window.domReady = function(callBack) {
1819
if (document.readyState === 'loading') {
1920
document.addEventListener('DOMContentLoaded', callBack);
2021
} else {
2122
callBack();
2223
}
23-
}
24+
};
2425
}
2526

2627
domReady(() => {
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<script>
2-
const serviceWorkerUrl = '{{ U_WEBPUSH_WORKER_URL }}';
3-
</script>
4-
{% INCLUDEJS('@phpbb_webpushnotifications/update_worker.js') %}
1+
{% if U_WEBPUSH_WORKER_URL %}
2+
<script>
3+
const serviceWorkerUrl = '{{ U_WEBPUSH_WORKER_URL }}';
4+
</script>
5+
{% INCLUDEJS '@phpbb_webpushnotifications/update_worker.js' %}
6+
{% endif %}

styles/prosilver/template/ucp_notifications_webpush.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
}
1818
</script>
1919

20-
{% INCLUDEJS('@phpbb_webpushnotifications/webpush.js') %}
21-
{% INCLUDECSS('@phpbb_webpushnotifications/phpbb_wpn.css') %}
20+
{% INCLUDEJS '@phpbb_webpushnotifications/webpush.js' %}
21+
{% INCLUDECSS '@phpbb_webpushnotifications/phpbb_wpn.css' %}

0 commit comments

Comments
 (0)