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

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.

composer: ComposerState = ...

An object which controls the state of the composer.

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.

An object which controls the state of the cached discussion list, which is used in the index page and the slideout pane.

drawer: Drawer

An object that manages the state of the navigation drawer.

forum: Forum

The forum model for this application.

history: History = ...

The app's history stack, which keeps track of which routes the user visits so that they can easily navigate back to the previous route.

initialRoute: string
initializers: ItemList<((app) => void)> = ...

An ordered list of initializers to bootstrap the application.

Type declaration

modal: ModalManagerState = ...

An object that manages modal state.

notificationComponents: Record<string, ComponentClass<{
    notification: Notification;
}, Notification<{
    notification: Notification;
}>>> = ...

A map of notification types to their components.

notifications: NotificationListState = ...

An object which controls the state of the user's notifications.

pane: null | Pane = null

An object which controls the state of the page's side pane.

postComponents: Record<string, ComponentClass<{
    post: Post;
}, Post<{
    post: Post;
}>>> = ...

A map of post types to their components.

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.

route: ((name, params?) => string) & ForumRoutes

Type declaration

    • (name, params?): string
    • Construct a URL to the route with the given name.

      Parameters

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

      Returns string

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 };

An object which stores the global search state and manages search capabilities.

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

  • Callback for when an external authenticator (social login) action has completed.

    If the payload indicates that the user has been logged in, then the page will be reloaded. Otherwise, a SignUpModal will be opened, prefilled with the provided details.

    Parameters

    • payload: Record<string, unknown>

    Returns void

  • Protected

    Used to modify the error message shown on the page to help troubleshooting. While not certain, a failing cross-origin request likely indicates a missing redirect to Flarum canonical URL. Because XHR errors do not expose CORS information, we can only compare the requested URL origin to the page origin.

    Parameters

    Returns boolean

Generated using TypeDoc v0.24.8