misc fixes:

- import from '@webrecorder/wabac' package for sw.js, though using github overrides for now
- replay: show loading spinner on beforeunload event in iframe
- embed: support passing basePageUrl param as part of extraConfig for custom top-level page
This commit is contained in:
Ilya Kreymer
2020-06-21 20:49:16 -07:00
parent e9bfcb28e9
commit d1d5fbd0e4
10 changed files with 41 additions and 25 deletions
+9 -3
View File
@@ -123,7 +123,7 @@ class Replay extends LitElement
this.replayTS = event.data.ts;
this.replayUrl = event.data.url;
this.title = event.data.title || this.title;
this.clearLoading();
this.clearLoading(iframe.contentWindow);
if (event.data.icons) {
const icons = event.data.icons;
@@ -166,17 +166,23 @@ class Replay extends LitElement
const iframe = this.renderRoot.querySelector("iframe");
if (!iframe || !iframe.contentDocument || !iframe.contentWindow ||
(iframe.contentDocument.readyState === "complete" && !iframe.contentWindow._WBWombat)) {
this.clearLoading();
this.clearLoading(iframe && iframe.contentWindow);
}
}, 5000);
}
clearLoading() {
clearLoading(iframeWin) {
this.isLoading = false;
if (this._loadPoll) {
window.clearInterval(this._loadPoll);
this._loadPoll = null;
}
if (iframeWin) {
iframeWin.addEventListener("beforeunload", () => {
this.isLoading = true;
});
}
}
static get styles() {