Custom SW filename (#175)

* embed: support using custom filename for service worker instead of sw.js
can be set via <replay-web-page swName='custom.js' ... > property
docs: update embedding docs to mention new option
fixes #160
This commit is contained in:
Ilya Kreymer
2023-06-14 17:06:51 -07:00
committed by GitHub
parent d767e6e164
commit d1e84b1b52
8 changed files with 1222 additions and 2663 deletions
+3 -2
View File
@@ -48,7 +48,8 @@ class Loader extends LitElement
embed: { type: String },
tryFileHandle: { type: Boolean },
errorAllowRetry: { type: Boolean },
extraMsg: { type: String }
extraMsg: { type: String },
swName: { type: String },
};
}
@@ -62,7 +63,7 @@ class Loader extends LitElement
if (!this.noWebWorker) {
// eslint-disable-next-line no-undef
this.worker = new Worker(__SW_NAME__);
this.worker = new Worker(this.swName);
} else {
if (!navigator.serviceWorker) {
return;