Skip to content

Commit 4e52913

Browse files
committed
pass url and timestamp
1 parent d96f659 commit 4e52913

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type ReplayLoadingDetail =
1919
| { loading: false; replayNotFoundError: boolean };
2020

2121
export type RwpPageLoadingEvent = CustomEvent<
22-
EmbedReplayData & {
22+
Required<Pick<EmbedReplayData, "url" | "ts">> & {
2323
type: "page-loading";
2424
} & ReplayLoadingDetail
2525
>;

src/item.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
5858
import "./item-info";
5959
import { dateTimeFormatter } from "./utils/dateTimeFormatter";
6060
import type {
61+
ReplayLoadingDetail,
6162
RwpPageLoadingEvent,
6263
RwpUrlChangeEvent,
6364
TabNavEvent,
@@ -1781,20 +1782,25 @@ class Item extends LitElement {
17811782
) {
17821783
const { loading, replayNotFoundError } = event.detail;
17831784
if (this.embed && window.parent !== window && this.isLoading !== loading) {
1784-
let msg: RwpPageLoadingEvent["detail"];
1785+
let loadingDetail: ReplayLoadingDetail;
17851786

17861787
if (loading) {
1787-
msg = {
1788-
type: "page-loading",
1788+
loadingDetail = {
17891789
loading,
17901790
};
17911791
} else {
1792-
msg = {
1793-
type: "page-loading",
1792+
loadingDetail = {
17941793
loading,
17951794
replayNotFoundError: replayNotFoundError ?? false,
17961795
};
17971796
}
1797+
const msg = {
1798+
...loadingDetail,
1799+
type: "page-loading",
1800+
url: this.tabData.url ?? "",
1801+
ts: this.tabData.ts ?? "",
1802+
} satisfies RwpPageLoadingEvent["detail"];
1803+
17981804
window.parent.postMessage(msg, "*");
17991805
}
18001806
this.isLoading = loading;

src/replay.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ class Replay extends LitElement {
318318
this.clearHilite(true);
319319
this.dispatchEvent(
320320
new CustomEvent<ReplayLoadingDetail>("replay-loading", {
321-
detail: { loading: true },
321+
detail: {
322+
loading: true,
323+
},
322324
}),
323325
);
324326
}

0 commit comments

Comments
 (0)