new WatchPage( spaInstance )

Description

Class for monitoring and logging mutations to a page.

This is intended to explore new and modified pages.

As elements are loaded, they are modified with a data-counter property to indicate the order they were loaded. This can be used to find page useful values for PageDetails's readySelector.

This class logs a lot and modifies every element encountered, slowing down pages. It is unlikely it should always be enabled.

After registering this class, in the console, do a query for the largest data-counter value to see what the last thing loaded was. Having timestamps turned on in the console helps identify when initial loading has completed.

Parameters
Name Type Description
spaInstance NexusHoratio.spa.SPA

SPA instance that manages this Page.

Examples
$$('[data-counter]:not(svg,img,figure)')
			  .map(x => [x.dataset.counter, x])
			  .sort((a,b) => (b[0] - a[0]))
Details

Members


dispatcher :NexusHoratio.base.Dispatcher


id :string

Details
string

logger :NexusHoratio.base.Logger


name :string

Details
string

pathname :RegExp

Details
RegExp

spa :NexusHoratio.spa.SPA

Methods


addService( Klass, ...rest ) → {NexusHoratio.base.Service}

Description
Parameters
Name Type Attributes Description
Klass function

A service class to instantiate. If this is a Page.Service subclass, the page property is also set.

rest object <repeatable>

Arbitrary objects to pass to constructor.

Returns

Instance of Klass.


<private> computePathnameRE( pathname ) → {RegExp}

Description

Turn a path into a RegExp.

Parameters
Name Type Description
pathname string | RegExp

A path to convert.

Returns

A converted path.


<private> waitUntilReady() → {external:Element}

Description

Wait until the page has loaded enough to continue.

Returns

The element matched by #readySelector.


<private> mutationHandler( records )

Description

MutationObserver callback.

Parameters
Name Type Description
records Array.<external:MutationRecord>

Standard mutation records.

Details

Events


activate


deactivate