Connect

The SPX initialization process involves invoking a default function, spx(), which returns a curried callback function designed to activate once the DOMContentLoaded event fires. At this juncture, SPX captures a snapshot of the document’s state by saving document.documentElement.outerHTML into its snapshot cache.

This initial snapshot serves as a baseline, reflecting the document’s state at the moment of initialization. This differs in subsequent visits, as snapshots are obtained using XHR over the wire.

Example 1

SPX Connection using default options:

Example 2

SPX Connection using default options with callback:

Example 3

SPX Connection with fragment[] options and callback:

Example 4

SPX Connection with curried callback reference: