export utils as public API
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import record from './record';
|
import record from './record';
|
||||||
import { Replayer } from './replay';
|
import { Replayer } from './replay';
|
||||||
import { mirror } from './utils';
|
import { mirror } from './utils';
|
||||||
|
import * as utils from './utils';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
EventType,
|
EventType,
|
||||||
@@ -11,4 +12,4 @@ export {
|
|||||||
|
|
||||||
const { addCustomEvent } = record;
|
const { addCustomEvent } = record;
|
||||||
|
|
||||||
export { record, addCustomEvent, Replayer, mirror };
|
export { record, addCustomEvent, Replayer, mirror, utils };
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ function initViewportResizeObserver(
|
|||||||
return on('resize', updateDimension, window);
|
return on('resize', updateDimension, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
const INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
|
export const INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
|
||||||
const MASK_TYPES = [
|
export const MASK_TYPES = [
|
||||||
'color',
|
'color',
|
||||||
'date',
|
'date',
|
||||||
'datetime-local',
|
'datetime-local',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { rebuild, buildNodeWithSN, idNodeMap } from 'rrweb-snapshot';
|
import { rebuild, buildNodeWithSN } from 'rrweb-snapshot';
|
||||||
import * as mittProxy from 'mitt';
|
import * as mittProxy from 'mitt';
|
||||||
import * as smoothscroll from 'smoothscroll-polyfill';
|
import * as smoothscroll from 'smoothscroll-polyfill';
|
||||||
import { Timer } from './timer';
|
import { Timer } from './timer';
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const mirror: Mirror = {
|
|||||||
const id = n.__sn && n.__sn.id;
|
const id = n.__sn && n.__sn.id;
|
||||||
delete mirror.map[id];
|
delete mirror.map[id];
|
||||||
if (n.childNodes) {
|
if (n.childNodes) {
|
||||||
n.childNodes.forEach(child =>
|
n.childNodes.forEach((child) =>
|
||||||
mirror.removeNodeFromMap((child as Node) as INode),
|
mirror.removeNodeFromMap((child as Node) as INode),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -83,9 +83,10 @@ export function hookSetter<T>(
|
|||||||
key: string | number | symbol,
|
key: string | number | symbol,
|
||||||
d: PropertyDescriptor,
|
d: PropertyDescriptor,
|
||||||
isRevoked?: boolean,
|
isRevoked?: boolean,
|
||||||
|
win = window,
|
||||||
): hookResetter {
|
): hookResetter {
|
||||||
const original = Object.getOwnPropertyDescriptor(target, key);
|
const original = win.Object.getOwnPropertyDescriptor(target, key);
|
||||||
Object.defineProperty(
|
win.Object.defineProperty(
|
||||||
target,
|
target,
|
||||||
key,
|
key,
|
||||||
isRevoked
|
isRevoked
|
||||||
@@ -130,7 +131,7 @@ export function isBlocked(node: Node | null, blockClass: blockClass): boolean {
|
|||||||
if (typeof blockClass === 'string') {
|
if (typeof blockClass === 'string') {
|
||||||
needBlock = (node as HTMLElement).classList.contains(blockClass);
|
needBlock = (node as HTMLElement).classList.contains(blockClass);
|
||||||
} else {
|
} else {
|
||||||
(node as HTMLElement).classList.forEach(className => {
|
(node as HTMLElement).classList.forEach((className) => {
|
||||||
if (blockClass.test(className)) {
|
if (blockClass.test(className)) {
|
||||||
needBlock = true;
|
needBlock = true;
|
||||||
}
|
}
|
||||||
|
|||||||
3
typings/index.d.ts
vendored
3
typings/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
|||||||
import record from './record';
|
import record from './record';
|
||||||
import { Replayer } from './replay';
|
import { Replayer } from './replay';
|
||||||
import { mirror } from './utils';
|
import { mirror } from './utils';
|
||||||
|
import * as utils from './utils';
|
||||||
export { EventType, IncrementalSource, MouseInteractions, ReplayerEvents, } from './types';
|
export { EventType, IncrementalSource, MouseInteractions, ReplayerEvents, } from './types';
|
||||||
declare const addCustomEvent: <T>(tag: string, payload: T) => void;
|
declare const addCustomEvent: <T>(tag: string, payload: T) => void;
|
||||||
export { record, addCustomEvent, Replayer, mirror };
|
export { record, addCustomEvent, Replayer, mirror, utils };
|
||||||
|
|||||||
2
typings/record/observer.d.ts
vendored
2
typings/record/observer.d.ts
vendored
@@ -1,2 +1,4 @@
|
|||||||
import { observerParam, listenerHandler, hooksParam } from '../types';
|
import { observerParam, listenerHandler, hooksParam } from '../types';
|
||||||
|
export declare const INPUT_TAGS: string[];
|
||||||
|
export declare const MASK_TYPES: string[];
|
||||||
export default function initObservers(o: observerParam, hooks?: hooksParam): listenerHandler;
|
export default function initObservers(o: observerParam, hooks?: hooksParam): listenerHandler;
|
||||||
|
|||||||
2
typings/utils.d.ts
vendored
2
typings/utils.d.ts
vendored
@@ -3,7 +3,7 @@ import { INode } from 'rrweb-snapshot';
|
|||||||
export declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | Window): listenerHandler;
|
export declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | Window): listenerHandler;
|
||||||
export declare const mirror: Mirror;
|
export declare const mirror: Mirror;
|
||||||
export declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (arg: T) => void;
|
export declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (arg: T) => void;
|
||||||
export declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean): hookResetter;
|
export declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean, win?: Window & typeof globalThis): hookResetter;
|
||||||
export declare function getWindowHeight(): number;
|
export declare function getWindowHeight(): number;
|
||||||
export declare function getWindowWidth(): number;
|
export declare function getWindowWidth(): number;
|
||||||
export declare function isBlocked(node: Node | null, blockClass: blockClass): boolean;
|
export declare function isBlocked(node: Node | null, blockClass: blockClass): boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user