Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MutationSummary

This is the main entry point class for the Mutation Summary library. When created, a MutationSummary takes care of the details of observing the DOM for changes, computing the "net-effect" of what's changed and then delivers these changes to the provided callback.

example

const ms = new MutationSummary({
callback(summaries: Summary[]) {
   summaries.forEach((summary: Summary) => console.log(summary));
 },
 queries: [
   { all: true }
 ]
});

Hierarchy

  • MutationSummary

Index

Constructors

constructor

Properties

Static createQueryValidator

createQueryValidator: (root: Node, query: IQuery) => IQueryValidator

Type declaration

Methods

disconnect

  • Discontinues observation immediately. If DOM changes are pending delivery, they will be fetched and reported as the same array of summaries which are handed into the callback. If there is nothing to report, this function returns undefined.

    Returns Summary[]

    A list of changes that have not yet been delivered to a callback.

reconnect

  • reconnect(): void
  • Starts observation using an existing MutationSummary which has been disconnected. Note that this function is just a convenience method for creating a new MutationSummary with the same options. The next time changes are reported, they will relative to the state of the observed DOM at the point that reconnect was called.

    Returns void

takeSummaries

  • Immediately calculates changes and returns them as an array of summaries. If there are no changes to report, returns undefined.

    Returns Summary[]

Generated using TypeDoc