Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DefaultResolver<Attrs, Comp, RouteArgs>

Generates a route resolver for a given component.

In addition to regular route resolver functionality:

  • It provide the current route name as an attr
  • It sets a key on the component so a rerender will be triggered on route change.

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

  • new DefaultResolver<Attrs, Comp, RouteArgs>(component: new () => Comp, routeName: string): DefaultResolver<Attrs, Comp, RouteArgs>

Properties

component

component: new () => Comp

Type declaration

    • new (): Comp
    • Returns Comp

routeName

routeName: string

Methods

makeAttrs

  • makeAttrs(vnode: Vnode<Attrs, Comp>): Attrs & { routeName: string }

makeKey

  • makeKey(): string
  • When a route change results in a changed key, a full page rerender occurs. This method can be overriden in subclasses to prevent rerenders on some route changes.

    Returns string

onmatch

  • onmatch(args: RouteArgs, requestedPath: string, route: string): new () => Comp
  • A method which selects which component to render based on conditional logic.

    Returns the component class, and not a Vnode or JSX expression.

    Parameters

    • args: RouteArgs
    • requestedPath: string
    • route: string

    Returns new () => Comp

      • new (): Comp
      • Returns Comp

render

  • render(vnode: Vnode<Attrs, Comp>): Children
  • A function which renders the provided component.

    If not specified, the route will default to rendering the component on its own, inside of a fragment.

    Returns a Mithril Vnode or other children.

    Parameters

    • vnode: Vnode<Attrs, Comp>

    Returns Children

Generated using TypeDoc version 0.22.10