new Page( details )

Description

Base class for handling various views of a Single-Page Applications.

Pages are created by subclassing with at least a custom constructor that provides PageDetails via super(). The classes are then registered with a SPA instance where they are instantiated with a single parameter of that same SPA.

Parameters
Name Type Description
details NexusHoratio.spa.Page~PageDetails

Details about the page.

Details

Classes


new Service()

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.

Details

<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.

Details

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

Description

Wait until the page has loaded enough to continue.

Returns

The element matched by #readySelector.

Details

Type Definitions


PageDetails

Properties
Name Type Attributes Default Description
spa NexusHoratio.spa.SPA

SPA instance that manages this Page.

name string <optional>
this.constructor.name

A human readable name for this page (normally parsed from the subclass name).

pathname string | RegExp <optional>
RegExp(.*)

Pathname portion of the URL this page should handle.

readySelector string <optional>
'body'

CSS selector that is used to detect that the page is loaded enough to activate.

readySelectorTimeout number <optional>
3000

Time to wait, in milliseconds, for the readySelector.

Details
object

Events


activate

Details

deactivate

Details