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:
10
src/types.ts
10
src/types.ts
@@ -166,6 +166,16 @@ export type hooksParam = {
|
||||
styleSheetRule?: styleSheetRuleCallback;
|
||||
};
|
||||
|
||||
// https://dom.spec.whatwg.org/#interface-mutationrecord
|
||||
export type mutationRecord = {
|
||||
type: string,
|
||||
target: Node,
|
||||
oldValue: string | null,
|
||||
addedNodes: NodeList,
|
||||
removedNodes: NodeList,
|
||||
attributeName: string | null,
|
||||
}
|
||||
|
||||
export type textCursor = {
|
||||
node: Node;
|
||||
value: string | null;
|
||||
|
||||
Reference in New Issue
Block a user