Class: GuardContext

lib/core/runtime/AvenxGuard.GuardContext(optionsopt)

The capabilities a guard is given when it runs.

Constructed per navigation by the router. Nothing here is mutable state: the bridges are the live reactive objects the rest of the application uses, so a guard reading context.bridge('session').signedIn sees exactly what a component reading the same bridge sees.

Constructor

new GuardContext(optionsopt)

Parameters:
Name Type Attributes Description
options object <optional>

Context sources.

Properties
Name Type Attributes Description
bridges object <optional>

The application's bridge registry.

app object <optional>

The application instance.

router object <optional>

The router performing the navigation.

Source:

Members

app :object|null

The application instance.

Type:
  • object | null
Source:

bridges :object

Registered bridges, by name.

Type:
  • object
Source:

router :object|null

The router performing this navigation.

Type:
  • object | null
Source:

Methods

bridge(name) → {any}

Looks a bridge up by name.

Returns undefined rather than throwing for an unknown name, so a guard can decide what an absent bridge means. A guard that imports its bridge directly does not need this; it exists for guards registered as plain functions, and for looking a bridge up dynamically.

Parameters:
Name Type Description
name string

The registered bridge name.

Source:
Returns:

The bridge, or undefined when it is not registered.

Type
any