@@ -25,6 +25,21 @@ function wrapEvent(e: event): eventWithTime {
|
||||
|
||||
let wrappedEmit!: (e: eventWithTime, isCheckout?: boolean) => void;
|
||||
|
||||
export function addCustomEvent<T>(tag: string, payload: T) {
|
||||
if (!wrappedEmit) {
|
||||
throw new Error('please add custom event after start recording');
|
||||
}
|
||||
wrappedEmit(
|
||||
wrapEvent({
|
||||
type: EventType.Custom,
|
||||
data: {
|
||||
tag,
|
||||
payload,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
function record(options: recordOptions = {}): listenerHandler | undefined {
|
||||
const {
|
||||
emit,
|
||||
|
||||
Reference in New Issue
Block a user