Dynamic module istory

Index

Variables

Functions

Variables

active: boolean

Indicates whether or not the history module is actively tracking history.

interval: number

The setTimeout interval used when the browser does not support hash change events.

default

50

Functions

activate(options: DurandalHistoryOptions): boolean

Activate the hash change handling, returning true if the current URL matches an existing route, and false otherwise.

Parameters

Returns

boolean

Returns true/false from loading the url unless the silent option was selected.

checkUrl(): boolean

Checks the current URL to see if it has changed, and if it has, calls loadUrl, normalizing across the hidden iframe.

Returns

boolean

Returns true/false from loading the url.

deactivate()

Disable history, perhaps temporarily. Not useful in a real app, but possibly useful for unit testing Routers.

getFragment(fragment: string, forcePushState: boolean): string

Get the cross-browser normalized URL fragment, either from the URL, the hash, or the override.

Parameters

  • fragment: string

    The fragment.

  • forcePushState: boolean

    Should we force push state?

Returns

string

he fragment.

getHash(window?: Window): string

Gets the true hash value. Cannot use location.hash directly due to a bug in Firefox where location.hash will always be decoded.

Parameters

  • window?: Window optional

Returns

string

The hash.

loadUrl(): boolean

Attempts to load the current URL fragment. A pass-through to options.routeHandler.

Returns

boolean

Returns true/false from the route handler.

navigate(fragment: string, trigger?: boolean): boolean

Save a fragment into the hash history, or replace the URL state if the 'replace' option is passed. You are responsible for properly URL-encoding the fragment in advance. The options object can contain trigger: false if you wish to not have the route callback be fired, or replace: true, if you wish to modify the current URL without adding an entry to the history.

Parameters

  • fragment: string

    The url fragment to navigate to.

  • trigger?: boolean optional

Returns

boolean

Returns true/false from loading the url.

navigate(fragment: string, options: DurandalNavigationOptions): boolean

Save a fragment into the hash history, or replace the URL state if the 'replace' option is passed. You are responsible for properly URL-encoding the fragment in advance. The options object can contain trigger: false if you wish to not have the route callback be fired, or replace: true, if you wish to modify the current URL without adding an entry to the history.

Parameters

  • fragment: string

    The url fragment to navigate to.

  • options: DurandalNavigationOptions

    An options object with optional trigger and replace flags. You can also pass a boolean directly to set the trigger option. Trigger is true by default.

Returns

boolean

Returns true/false from loading the url.

navigateBack()

Navigates back in the browser history.