Views
The View class: state, templates, event handlers, children and the render lifecycle.
The architecture of an altseven application, and the concepts you need before building real features.
Everything in altseven hangs off an Application instance. You create one at
startup, pass it options, and export it so the rest of your code can use it:
import { Application } from "/lib/altseven/dist/a7.js";
export const myApp = new Application( {
name: "myapp",
security: { enabled: false }
} );
The instance name you choose (myApp here, a7 if you want the legacy name)
becomes the namespace for your whole application. The Application constructor
synchronously builds the module registry from your options; init() (called
automatically when you construct the application) then initializes each module
and, if security is enabled, awaits the authentication check before your code
continues.
| Property | Module | Purpose |
|---|---|---|
myApp.log |
LogManager | Leveled logging |
myApp.model |
ModelManager | Application-wide data store with undo/redo |
myApp.remote |
RemoteManager | AJAX fetch, remote modules, WebSockets |
myApp.services |
ServiceManager | Registry of your Service instances |
myApp.dataproviders |
DataProviderManager | Registry of DataProviders and their bindings |
myApp.events |
EventManager | Publish/subscribe topics |
myApp.security |
SecurityManager | Session/user state |
myApp.router |
RouterManager | URL routing (only if options.router is set) |
myApp.ui |
UIManager | View registry and render queue |
myApp.error |
ErrorManager | Global error capture |
myApp.console |
Console | Optional in-browser console |
myApp.constants |
— | Convention: your app-wide constants |
myApp.user |
— | Convention: the session user (when security is enabled) |
altseven is an ES modules project. The framework ships as a single ES module
(dist/a7.js) that exports the classes you build with: Application, View,
Entity, Service, DataProvider, and a few others. Your application code is
also organized as ES modules — there is no bundler, so your server must serve
each file and the browser resolves the import graph at load time.
my-app/
├── index.html
├── assets/
│ └── js/
│ ├── app.js # bootstrap: Application, options, routes, top views
│ ├── entity/ # Entity subclasses (data schemas)
│ ├── service/ # Service subclasses (CRUD + caching)
│ ├── dataprovider/ # DataProvider subclasses (view state + bindings)
│ └── view/ # View factories (components)
Everything is configured through the options structure passed to the
Application constructor — logging, authentication, remote endpoints, routing,
UI behavior. All options have defaults, so {} is valid, but most real apps set
at least remote, router and logging. The full reference is in
Configuring Your Application.
Views render HTML with template literals. Template literal expressions
(${ ... }) are plain JavaScript, so you can compute, filter and join inside
templates without learning a template language. Interactivity is declared with
data-on<event> attributes in the template and implemented in a parallel
eventHandlers object on the view. See Views.
The View class: state, templates, event handlers, children and the render lifecycle.
The publish/subscribe event system and the conventions for using it well.
Client-side URL routing: route tables, parameters, and browser history.
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.