Resolves https://github.com/webrecorder/replayweb.page/issues/481 with workaround Related to https://github.com/webrecorder/browsertrix/issues/2865 ## Changes - Includes `replayNotFoundError` in `"page-loading"` event when page is finished loading as a workaround for the actual `replayNotFoundError` value not being available on `urlchange`. - Minor refactor to more strongly typed events.
26 lines
593 B
TypeScript
26 lines
593 B
TypeScript
import type { EmbedReplayData, TabData } from "./item";
|
|
|
|
export type TabNavEvent = CustomEvent<{
|
|
data: TabData;
|
|
reload?: boolean;
|
|
replaceLoc?: boolean;
|
|
replayNotFoundError?: boolean;
|
|
}>;
|
|
|
|
export type RwpUrlChangeEvent = CustomEvent<
|
|
EmbedReplayData & {
|
|
type: "urlchange";
|
|
replayNotFoundError: boolean;
|
|
}
|
|
>;
|
|
|
|
export type ReplayLoadingDetail =
|
|
| { loading: true }
|
|
| { loading: false; replayNotFoundError: boolean };
|
|
|
|
export type RwpPageLoadingEvent = CustomEvent<
|
|
Required<Pick<EmbedReplayData, "url" | "ts">> & {
|
|
type: "page-loading";
|
|
} & ReplayLoadingDetail
|
|
>;
|