Files
rrweb/typings/record/mutation.d.ts
Eoghan Murray d57cae3d51 Move mutation processing into it's own class (#223)
* Move mutation processing into it's own object.

This should stand on it's own as a refactor, but is intended as a basis
for exposing the new MutationBuffer object to further outside control e.g.
to 'mute' or batch up mutation emission when the page becomes inactive
from a https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
point of view

* The `processMutations` function needed to be bound to the `mutationBuffer` object, as otherwise `this` referred to the `MutationObserver` object itself

* Neglected to add this output of `npm run typings`

* Get around the binding problem by using Arrow function expressions

* Prettier formatting
2026-04-01 12:00:00 +08:00

21 lines
635 B
TypeScript

import { mutationRecord, blockClass, mutationCallBack } from '../types';
export default class MutationBuffer {
private texts;
private attributes;
private removes;
private adds;
private movedMap;
private addedSet;
private movedSet;
private droppedSet;
private emissionCallback;
private blockClass;
private inlineStylesheet;
private maskAllInputs;
constructor(cb: mutationCallBack, blockClass: blockClass, inlineStylesheet: boolean, maskAllInputs: boolean);
processMutations(mutations: mutationRecord[]): void;
private processMutation;
private genAdds;
emit(): void;
}