perf: Avoid an extra function call and object clone during event emission (#1441)

performance: remove a nested function call and an object clone during event emission

 - rename `event` to `eventWithoutTime`, but maintain backwards compatibility
 - `eventWithTime` (with time) could be renamed to `event` in a future version

This is an extension of PR #1339 authored by: mydea <mydea@users.noreply.github.com>
This commit is contained in:
Eoghan Murray
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 28f32140f0
commit 049274dd37
5 changed files with 151 additions and 177 deletions

View File

@@ -163,7 +163,7 @@ export type incrementalData =
| adoptedStyleSheetData
| customElementData;
export type event =
export type eventWithoutTime =
| domContentLoadedEvent
| loadedEvent
| fullSnapshotEvent
@@ -172,7 +172,13 @@ export type event =
| customEvent
| pluginEvent;
export type eventWithTime = event & {
/**
* @deprecated intended for internal use
* a synonym for eventWithoutTime
*/
export type event = eventWithoutTime;
export type eventWithTime = eventWithoutTime & {
timestamp: number;
delay?: number;
};