Skip to content

Commit

Permalink
Satisfy typings
Browse files Browse the repository at this point in the history
  • Loading branch information
eoghanmurray committed Oct 14, 2024
1 parent b975eef commit 2841dff
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/rrweb/src/replay/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EventType,
type Emitter,
IncrementalSource,
type metaEvent,
} from '@rrweb/types';
import { Timer, addDelay } from './timer';

Expand Down Expand Up @@ -59,6 +60,17 @@ export type PlayerState =
context: PlayerContext;
};



type metaEventWithTime = metaEvent & {
timestamp: number;
delay?: number;
};

function isMetaEvent(e: eventWithTime): e is metaEventWithTime {
return e.type === EventType.Meta;
}

/**
* If the array have multiple meta and fullsnapshot events,
* return the events from last meta to the end.
Expand Down Expand Up @@ -311,9 +323,8 @@ export function createPlayerService(
event.data.capturedAssetStatuses
) {
awaitAssetsHref = '';
const earlierMetas = events.filter(
(e) =>
e.type === EventType.Meta && e.timestamp <= event.timestamp,
const earlierMetas: metaEvent[] = events.filter(isMetaEvent).filter(
(e) => e.timestamp <= event.timestamp,
);
if (earlierMetas.length) {
awaitAssetsHref =
Expand Down

0 comments on commit 2841dff

Please sign in to comment.