Options
All
  • Public
  • Public/Protected
  • All
Menu
description

This class handles parsing module files to generate dynamic routes. It accepts a Module module configuration object

Note that this class uses a variant of the Singleton design pattern to forbid the instanciation of more than one application kernel in a process. You must always use the static getInstance function to retrieve the instance of the application kernel.

example

Using the AppKernel class

  const app = AppKernel.getInstance();
console.log(app.getRoutes());



Properties

param modules

The module configuration to parse, i.e. this should

param routes

The application routes that can be accessed by URL. This contains keys that are fully qualified URIs.

since

v0.1.0

Hierarchy

  • AppKernel

Index

Constructors

  • Constructs an application kernel instance. This class sets the modules and routes properties of the instance.

    access

    protected

    Parameters

    • modules: Record<string, Module>

      The module configuration that is parsed to retrieve routes and cards.

    • routes: Record<string, Page>

      The application routes that can be accessed by URL. This contains keys that are fully qualified URIs.

    Returns AppKernel

Properties

modules: Record<string, Module>

The module configuration that is parsed to retrieve routes, cards and other configuration options.

access

protected

var

{Record<string, Module>}

routes: Record<string, Page>

The routes that are configured with this software and accessible by URI. This property stores Page objects and maps them to unique URIs ("routes").

access

protected

var

{Record<string, Page>}

INSTANCE: AppKernel

The only instance of this class that can exist in the lifetime of one application process. The access to this is private such that this variable can only be accessed and modified using internal methods.

access

private

var

{AppKernel}

Methods

  • getModule(identifier: string): undefined | Module
  • getPage(identifier: string): undefined | Page
  • getRoutes(): RouteConfig[]
  • Returns routes that are compatible with vue-router and contain information about the displayed component.

    We use route level code-splitting with an arrow function at the route-level component field so that a separate chunk file is generated for each route (about.[hash].js) and those are lazy-loaded only when the route is visited.

    Note that we use the {@link Assembler} component to render dynamic module pages and that the route name is always set to the page's identifier.

    access

    public

    Returns RouteConfig[]

    An array of vue-router compatible route objects that map to a specific component.

  • Create an instance of the application kernel using a set of Module module configuration objects.

    This method uses a module's identifier to store it in a property modules and reads its configuration to find routes that are stored in a property routes.

    Note that module identifiers must be unique across dapp configuration files. There cannot be a module identifier that refers to multiple modules.

    Note also, that you can enable namespaced routes with the namespaced property on Module objects.

    access

    public

    static

    Returns AppKernel

    A configured application kernel ready to serve dynamic routes with the {@link Assembler}.

Generated using TypeDoc