DEV: Allow register options to be passed to `registerServiceWorker` (#14609)

DEV: Allow register options to be passed to registerServiceWorker (#14609)

diff --git a/app/assets/javascripts/discourse/app/lib/register-service-worker.js b/app/assets/javascripts/discourse/app/lib/register-service-worker.js
index 3cd2200..095ac6c 100644
--- a/app/assets/javascripts/discourse/app/lib/register-service-worker.js
+++ b/app/assets/javascripts/discourse/app/lib/register-service-worker.js
@@ -1,6 +1,10 @@
 import getAbsoluteURL, { isAbsoluteURL } from "discourse-common/lib/get-url";
 
-export function registerServiceWorker(container, serviceWorkerURL) {
+export function registerServiceWorker(
+  container,
+  serviceWorkerURL,
+  registerOptions = {}
+) {
   const isSecured = document.location.protocol === "https:";
 
   if (isSecured && "serviceWorker" in navigator) {
@@ -22,7 +26,7 @@ export function registerServiceWorker(container, serviceWorkerURL) {
       });
 
       navigator.serviceWorker
-        .register(getAbsoluteURL(`/${serviceWorkerURL}`))
+        .register(getAbsoluteURL(`/${serviceWorkerURL}`), registerOptions)
         .catch((error) => {
           // eslint-disable-next-line no-console
           console.info(`Failed to register Service Worker: ${error}`);

GitHub sha: 9b835e1003e1384ddddc630898d754e54269c13a

This commit appears in #14609 which was approved by Falco. It was merged by markvanlan.