Page MenuHomeGitPull.it

class JX.History
Javelin Documentation ()

JX.History provides a stable interface for managing the browser's history stack. Whenever the history stack mutates, the "history:change" event is invoked via JX.Stratcom.

Inspired by History Manager implemented by Christoph Pojer (@cpojer)

Tasks

Builtin Events

  • invoke(type, more) — Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see @{function:JX.install} for documentation. Any arguments you provide will be passed to listener callbacks.
  • static listen(type, callback) — Static listen interface for listening to events produced by any instance of this class. See @{method:listen} for documentation.

Other Methods

  • static install(mechanism) — Starts history management. This method must be invoked first before any other JX.History method can be used.
  • static getMechanism() — Get the name of the mechanism used to interface with the browser history stack.
  • static getPath() — Returns the path on top of the history stack.
  • static push(path, state) — Pushes a path onto the history stack.
  • static replace(path) — Modifies the path on top of the history stack.
  • private static _handleChange(e)
  • private static _fire(path, state)
  • private static _getBasePath(href)
  • private static _composeFragment(path)
  • private static _parseFragment(fragment)

Methods

invoke(type, more)
Inherited

JX.Base

Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see JX.install() for documentation. Any arguments you provide will be passed to listener callbacks.

Parameters
stringtypeEvent type, must be declared when class is installed.
...moreZero or more arguments.
Return
JX.EventEvent object which was dispatched.

static listen(type, callback)
Inherited

JX.Base

Listen for events emitted by this object instance. You can also use the static flavor of this method to listen to events emitted by any instance of this object.

See also listen() in JX.Stratcom.

JX.Base

Static listen interface for listening to events produced by any instance of this class. See listen() for documentation.

Parameters
stringtypeType of event to listen for.
functioncallbackFunction to call when this event occurs.
Return
objectA reference to the installed listener. You can later remove the listener by calling this object's remove() method.

static install(mechanism)

Starts history management. This method must be invoked first before any other JX.History method can be used.

Parameters
intmechanismAn optional mechanism used to interface with the browser history stack. If it is not supported, the next supported mechanism will be used.

static getMechanism()

Get the name of the mechanism used to interface with the browser history stack.

Return
stringMechanism, either pushstate, hashchange, or polling.

static getPath()

Returns the path on top of the history stack.

If the HTML5 History API is unavailable and an eligible path exists in the current URL fragment, the fragment is parsed for a path. Otherwise, the current URL path is returned.

Return
stringPath on top of the history stack.

static push(path, state)

Pushes a path onto the history stack.

Parameters
stringpathPath.
wildstateState object for History API.
Return
void

static replace(path)

Modifies the path on top of the history stack.

Parameters
stringpathPath.
Return
void

private static _handleChange(e)

This method is not documented.
Parameters
e

private static _fire(path, state)

This method is not documented.
Parameters
path
state

private static _getBasePath(href)

This method is not documented.
Parameters
href

private static _composeFragment(path)

This method is not documented.
Parameters
path

private static _parseFragment(fragment)

This method is not documented.
Parameters
fragment
Defined
lib/History.js:21
Extends
JX.Base