Base App and Launching
Overview
This page explains how the app boots: IoC container creation, platform-specific initialization, loading style.json
, and starting the main loop.
Launch Sequence
Key Steps
- Base constructor calls
begin()
which orchestrates setup. - IoC is created via
PlatformAppInitializer.createIOCContainer(custom)
, merging base → platform → custom services. beforeLaunch()
invokesPlatformAppInitializer.beforePlatformLaunch(app)
for platform hooks.runAppLaunchSequence()
runs:initializeAsyncServices()
→loadAppConfig()
(readsassets/meta/style.config.json
) →precreateSGViews()
.resolveIOCDependencies()
pulls core services from IoC and registersapp
for convenience.- Main loop starts;
onLaunch()
is called when ready.
Tip: Initialization Order
Order matters. IoC must exist before any views relying on injected services are instantiated.
IoC Access
- Use
@inject()
without args to resolve by property name, or@inject('key')
to resolve by explicit key. IocContainer.resolve/register
are exposed viaAppUtils.resolve<T>(key)
andAppUtils.register(key, value)
for convenience with generics.
Where Services Come From
PlatformAppInitializer
provides platform overrides (e.g., hosannaDevice
), while apps add custom services via getCustomIOCServices()
.