Application
Direct Subclass:
The App
class provides a container for an application, as well as various
utilities for the rest of the app to use.
Member Summary
Public Members | ||
public |
An object that manages the state of active alerts. |
|
public |
Whether or not the app has been booted. |
|
public |
A local cache that can be used to store data at the application level, so that is persists between different routes. |
|
public |
The page the app is currently on. |
|
public |
data: * |
|
public |
drawer: * |
|
public |
The forum model for this application. |
|
public |
initialRoute: * |
|
public |
An ordered list of initializers to bootstrap the application. |
|
public |
modal: * |
|
public |
The page the app was on before the current page. |
|
public |
A map of routes, keyed by a unique route name. |
|
public |
The app's session. |
|
public |
The app's data store. |
|
public |
title: * |
|
public |
titleCount: * |
|
public |
The app's translator. |
Private Members | ||
private |
requestErrorAlert: int The key for an Alert that was shown as a result of an AJAX request error. |
Method Summary
Public Methods | ||
public |
boot() |
|
public |
bootExtensions(extensions: *) |
|
public |
load(payload: *) |
|
public |
|
|
public |
Get the API response document that has been preloaded into the application. |
|
public |
Make an AJAX request, handling any low-level errors that may occur. |
|
public |
Construct a URL to the route with the given name. |
|
public |
Determine the current screen mode, based on our media queries. |
|
public |
Set the <title> of the page. |
|
public |
setTitleCount(count: Integer) Set a number to display in the <title> of the page. |
|
public |
|
Private Methods | ||
private |
showDebug(error: RequestError, formattedError: string[]) |
Public Members
public cache: Object source
A local cache that can be used to store data at the application level, so that is persists between different routes.
public current: PageState source
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.
public data: * source
public drawer: * source
public initialRoute: * source
public modal: * source
public previous: PageState source
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.
public routes: Object source
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.component()};
public title: * source
public titleCount: * source
Private Members
private requestErrorAlert: int source
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.
Public Methods
public boot() source
public bootExtensions(extensions: *) source
Params:
Name | Type | Attribute | Description |
extensions | * |
public load(payload: *) source
Params:
Name | Type | Attribute | Description |
payload | * |
public mount(basePath: string) source
Params:
Name | Type | Attribute | Description |
basePath | string |
|
public preloadedApiDocument(): Object | null source
Get the API response document that has been preloaded into the application.
public request(options: Object): Promise source
Make an AJAX request, handling any low-level errors that may occur.
Params:
Name | Type | Attribute | Description |
options | Object |
public route(name: String, params: Object): String source
Construct a URL to the route with the given name.
public setTitle(title: String) source
Set the <title> of the page.
Params:
Name | Type | Attribute | Description |
title | String |
public setTitleCount(count: Integer) source
Set a number to display in the <title> of the page.
Params:
Name | Type | Attribute | Description |
count | Integer |
public updateTitle() source
Private Methods
private showDebug(error: RequestError, formattedError: string[]) source
Params:
Name | Type | Attribute | Description |
error | RequestError | ||
formattedError | string[] |
|