The App class provides a container for an application, as well as various utilities for the rest of the app to use.

Hierarchy

Constructors

Properties

_title: string = ''
_titleCount: number = 0
alerts: AlertManagerState = ...

An object that manages the state of active alerts.

booted: boolean = false

Whether or not the app has been booted.

cache: Record<string, unknown> = {}

A local cache that can be used to store data at the application level, so that is persists between different routes.

current: PageState = ...

The page the app is currently on.

This object holds information about the type of page we are currently visiting, and sometimes additional arbitrary page state that may be relevant to lower-level components.

drawer: Drawer

An object that manages the state of the navigation drawer.

forum: Forum

The forum model for this application.

history: null | IHistory = null
initialRoute: string
initializers: ItemList<((app: Application) => void)> = ...

An ordered list of initializers to bootstrap the application.

modal: ModalManagerState = ...

An object that manages modal state.

pane: any = null
previous: PageState = ...

The page the app was on before the current page.

Once the application navigates to another page, the object previously assigned to this.current will be moved to this.previous, while this.current is re-initialized.

requestErrorAlert: null | number = null

The key for an Alert that was shown as a result of an AJAX request error. If present, it will be dismissed on the next successful request.

routes: Record<string, FlarumGenericRoute> = {}

A map of routes, keyed by a unique route name. Each route is an object containing the following properties:

  • path The path that the route is accessed at.
  • component The Mithril component to render when this route is active.

Example

app.routes.discussion = { path: '/d/:id', component: DiscussionPage };
session: Session

The app's session.

Stores info about the current user.

store: Store = ...

The app's data store.

translator: Translator = ...

The app's translator.

Accessors

Methods

  • Parameters

    • extensions: Record<string, {
          extend?: unknown[];
      }>

    Returns void

  • Parameters

    • e: unknown
    • isDebug: boolean
    • formattedErrors: string[]

    Returns void

  • Construct a URL to the route with the given name.

    Parameters

    • name: string
    • params: Record<string, unknown> = {}

    Returns string

  • Set the <title> of the page.

    Parameters

    • title: string

      New page title

    Returns void

  • Set a number to display in the <title> of the page.

    Parameters

    • count: number

      Number to display in title

    Returns void

Generated using TypeDoc v0.23.24