Constructor
new AvenxApp(config)
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
config |
object | Application configuration. Properties
|
- Source:
Classes
Members
activePage
Retrieves the currently active page component instance.
- Source:
bridges :object
Type:
- object
- Source:
components :Map:.<string:, function()>
Type:
- Source:
directives :Map:.<string:, object:>
Type:
- Source:
enableProfiling :boolean
Type:
- boolean
- Source:
pages :Map:.<string:, function()>
Type:
- Source:
router :AvenxRouter|null
Type:
- AvenxRouter | null
- Source:
Methods
clearKeepAliveCache(componentNameopt) → {boolean}
Programmatically clears cached KeepAlive component instances. If componentName is specified, invalidates only that cached instance. If omitted, purges all cached entries. Unmounts cached instances and destroys their cached DOM trees.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
componentName |
string |
<optional> |
Optional name of component/page to clear from cache. |
- Source:
Returns:
True if cache entries were evicted, false otherwise.
- Type
- boolean
directive(name, definition) → {AvenxApp}
Registers a custom directive with the application.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name of the directive. |
definition |
object | The directive definition with lifecycle hooks. |
- Source:
Returns:
The app instance.
- Type
- AvenxApp
getRegisteredComponents() → {Array:.<string:>}
Returns the names of all registered components.
- Source:
Returns:
Registered component names.
getRegisteredPages() → {Array:.<string:>}
Returns the names of all registered pages.
- Source:
Returns:
Registered page names.
initRouter(routes, optionsopt) → {AvenxRouter}
Initializes the router for the application.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
routes |
Object:.<string:, string:> | Route mapping. |
|
options |
object |
<optional> |
Router options. |
- Source:
Returns:
The router instance.
- Type
- AvenxRouter
mixin(mixin) → {AvenxApp}
Registers a global mixin.
Parameters:
| Name | Type | Description |
|---|---|---|
mixin |
object | The mixin definition. |
- Source:
Returns:
The app instance.
- Type
- AvenxApp
mount(name, targetSelectoropt)
Mounts a component to a target element.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string | The name of the component to mount. |
||
targetSelector |
string | null |
<optional> |
null | Optional selector for the mount target. |
- Source:
mountPage(name, paramsopt, optionsopt)
Mounts a page to the main application container.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
string | The name of the page to mount. |
|
params |
object |
<optional> |
Dynamic route parameters to inject. |
options |
object |
<optional> |
Mount options, e.g., transition options. |
- Source:
onError(callback) → {AvenxApp}
Registers an application-wide error handler.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function | The error callback. |
- Source:
Returns:
The app instance.
- Type
- AvenxApp
onWarn(callback) → {AvenxApp}
Registers an application-wide warning handler.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function | The warning callback. |
- Source:
Returns:
The app instance.
- Type
- AvenxApp
register(name, compClass)
Registers a component with the application.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name of the component. |
compClass |
function | The component class. |
- Source:
registerBridge(name, bridgeData)
Registers a bridge with the application. Bridges provide shared state and logic across components.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name of the bridge. |
bridgeData |
object | A bridge() instance or a plain reactive object. |
- Source:
registerPage(name, pageClass)
Registers a page with the application.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name of the page. |
pageClass |
function | The page class. |
- Source:
updateAll()
Updates all active components in the application.
- Source:
use(plugin, optionsopt) → {AvenxApp|Promise:.<AvenxApp:>}
Registers a plugin with the application. Supports synchronous plugins, async installer functions, dynamic import loader functions, or Promises.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
plugin |
object | function | Promise | The plugin to install or async loader function. |
|
options |
object |
<optional> |
Optional configurations for the plugin. |
- Source:
Returns:
The app instance or a Promise resolving to the app instance.