Class: AvenxRouter

AvenxRouter(app, routes, optionsopt)

AvenxRouter handles routing for the application. Matches URL route definitions to specific Page components using pluggable navigation delegates.

Constructor

new AvenxRouter(app, routes, optionsopt)

Parameters:
Name Type Attributes Description
app AvenxApp

The main application instance.

routes Object:.<string:, (string:|object:)>

A map of hash routes to page names or route definitions.

options object <optional>

Optional router configurations (e.g. prefix, delegate, mode).

Source:

Classes

AvenxRouter

Members

a11y :object

Type:
  • object
Source:

afterHooks :Array:.<function()>

Type:
  • Array:.<function()>
Source:

app :AvenxApp

Type:
Source:

beforeHooks :Array:.<(function()|object:)>

Type:
  • Array:.<(function()|object:)>
Source:

currentRoute

Getter for currentRoute. Returns null if null was assigned, or the stable reactive proxy.

Source:

currentRoute

Setter for currentRoute. Reactively updates the stable proxy properties.

Source:

delegate :object

Type:
  • object
Source:

hashToIgnore :string|null

Type:
  • string | null
Source:

options :object

Type:
  • object
Source:

redirectContext :Object|null

Type:
  • Object | null
Source:

routes :Object:.<string:, (string:|object:)>

Type:
  • Object:.<string:, (string:|object:)>
Source:

Methods

afterEach(callback) → {function}

Registers a global after hook callback that executes after successful route navigation.

Parameters:
Name Type Description
callback function

The callback to execute after navigation.

Source:
Returns:

Unregister function.

Type
function

back()

Steps backward in navigation history.

Source:

beforeEach(callback) → {function}

Registers a global guard callback that executes before route guards on navigation transitions.

Parameters:
Name Type Description
callback function | object

The guard callback or guard instance/class.

Source:
Returns:

Unregister function.

Type
function

destroy()

Destroys the router and cleans up event listeners.

Source:

forward()

Steps forward in navigation history.

Source:

getRoutes() → {Array:.<{pattern:: string:, definition:: (string:|object:)}>}

Returns a snapshot of all registered routes.

Source:
Returns:
Type
Array:.<{pattern:: string:, definition:: (string:|object:)}>

go(delta)

Moves to a specific history position relative to current position.

Parameters:
Name Type Description
delta number

Relative step count in history (e.g. -1 for back, 1 for forward).

Source:

matches(hash) → {boolean}

Checks if this router has a matching route (excluding fallback) for the given hash.

Parameters:
Name Type Description
hash string

The URL hash.

Source:
Returns:

True if a non-fallback route matches.

Type
boolean

Navigates to a specific hash route.

Parameters:
Name Type Attributes Description
hash string

The target hash (e.g., '#/about').

options Object <optional>

Navigation options.

Source:

start()

Starts the router and handles the initial route.

Source: