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
This commit is contained in:
20
typings/record/mutation.d.ts
vendored
Normal file
20
typings/record/mutation.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user