Skip to content

Commit

Permalink
Merge pull request #42 from iMattPro/fixes
Browse files Browse the repository at this point in the history
Service Worker Updater Fixes
  • Loading branch information
iMattPro authored May 28, 2024
2 parents 301ff6b + e9e96a8 commit 08c7348
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion styles/all/template/update_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ function webpushWorkerUpdate() {
}
}
// Do not redeclare function if exist
/* global domReady */
if (typeof domReady === 'undefined') {
window.domReady = function(callBack) {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', callBack);
} else {
callBack();
}
}
};
}

domReady(() => {
Expand Down
10 changes: 6 additions & 4 deletions styles/prosilver/template/event/overall_footer_after.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script>
const serviceWorkerUrl = '{{ U_WEBPUSH_WORKER_URL }}';
</script>
{% INCLUDEJS('@phpbb_webpushnotifications/update_worker.js') %}
{% if U_WEBPUSH_WORKER_URL %}
<script>
const serviceWorkerUrl = '{{ U_WEBPUSH_WORKER_URL }}';
</script>
{% INCLUDEJS '@phpbb_webpushnotifications/update_worker.js' %}
{% endif %}
4 changes: 2 additions & 2 deletions styles/prosilver/template/ucp_notifications_webpush.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
}
</script>

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

0 comments on commit 08c7348

Please sign in to comment.