Configuring Your Application
The complete options reference for new Application( options ). All options
have defaults; the only required option for a working app is remote: {}
(or a populated remote config).
The options structure
import { Application } from "/lib/altseven/dist/a7.js";
export const myApp = new Application( {
name: "myapp",
auth: { sessionTimeout: 15 * 60 * 1000 },
console: { enabled: false },
events: {},
logging: { logLevel: "ERROR,FATAL,INFO", toBrowserConsole: false },
model: "altseven",
remote: {
loginURL: "",
logoutURL: "",
refreshURL: "",
useTokens: true,
tokenType: "X-Token",
credentials: "same-origin",
modules: {}
},
router: undefined, // omit entirely to run without routing
security: { enabled: true, userArgs: {} },
services: [],
ui: {
enableMouseTracking: false,
mouseTrackingDeBounceTime: 100,
renderer: "templateLiterals",
debounceTime: 18,
timeout: 600000,
cacheTemplates: true
}
} );
Reference
name (string, default "a7")
The application’s name. Naming the exported instance (export const myApp)
gives your code its namespace; name appears in logs.
auth.sessionTimeout (ms, default 900000 — 15 minutes)
How often the framework calls the refresh endpoint to keep the session alive.
console
The in-browser console that displays log messages in real time — including back-end logs relayed over WebSocket.
| Key | Type / default | Meaning |
|---|---|---|
enabled |
boolean, false |
Create the console at init |
wsServer |
string, "" |
WebSocket URL to receive remote log messages |
container |
object, FloatingPane if gadget-ui present | Container component |
top, left |
integer, 100 / 500 |
Position |
width, height |
integer, 500 / 300 |
Size |
events (object, {})
Topics to subscribe at init: { "topic.name": handlerFunction }. A null
value declares the topic without a handler (a view can subscribe later).
logging
| Key | Type / default | Meaning |
|---|---|---|
logLevel |
string, "ERROR,FATAL,INFO" |
Enabled levels: TRACE,DEBUG,INFO,WARN,ERROR,FATAL |
toBrowserConsole |
boolean, false |
Mirror log messages to console |
Usage: myApp.log.info( "..." ), myApp.log.debug( "..." ),
myApp.log.error( "msg", error ).
model (string or object, default "altseven")
"altseven" uses the built-in model (with undo/redo/rewind/fast-forward
history); "gadgetui" uses the gadget-ui model; or pass a custom object with
the same get/set/exists/bind methods.
remote
Required — pass at least remote: {}. Without the option, init() throws.
| Key | Type / default | Meaning |
|---|---|---|
modules |
object, {} |
Your remote modules (see Remote Modules) |
loginURL |
string, "" |
Login endpoint (HTTP Basic auth) |
logoutURL |
string, "" |
Logout endpoint |
refreshURL |
string, "" |
Session refresh endpoint |
useTokens |
boolean, true |
Send session tokens with secure calls |
tokenType |
string, "X-Token" |
"X-Token" header, or "access_token" for Authorization: Bearer |
credentials |
string, "same-origin" |
fetch credentials mode; "include" for SAML/cross-origin cookie SSO |
router (object, optional)
Omit the option entirely to run without routing. Otherwise:
| Key | Type / default | Meaning |
|---|---|---|
routes |
array | [ path, handler ] pairs (see Routing) |
useEvents |
boolean, true |
Handlers are event topic names (vs. functions) |
security
| Key | Type / default | Meaning |
|---|---|---|
enabled |
boolean, true |
Run the auth check at init and manage the session user |
userArgs |
object, {} |
Default fields for the User object, e.g. { userID: "" } |
With security enabled, init() awaits security.isAuthenticated() and sets
myApp.authenticated and myApp.user before your startup code continues.
services (array, [])
Service instances to register automatically at init — equivalent to calling
myApp.services.register( service ) for each.
ui
| Key | Type / default | Meaning |
|---|---|---|
renderer |
string, "templateLiterals" |
Also "Mustache" / "Handlebars" (auto-detected if those libraries are loaded) |
debounceTime |
ms, 18 |
Debounce window for render events |
timeout |
ms, 600000 |
Stale-view check interval for transient views (10 minutes) |
cacheTemplates |
boolean, true |
App-wide master switch for template caching; per-view props.cacheTemplate is still opt-in (default false) |
enableMouseTracking |
boolean, false |
Track the mouse position (myApp.ui.mousePosition), debounced by mouseTrackingDeBounceTime |
Conventional properties
Set by the framework (not options): myApp.constants (your app-wide constants)
and myApp.user (the session user when security is enabled).
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.