Hosanna UI API v1.30.2-next
    Preparing search index...

    The main application base class. Handles app lifecycle, dependency injection, scene/view management, main loop, and dialog management. Extend this class to implement your application logic.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Accessors

    Methods

    addChild addChildren addDialogManager addMouseInspectionListeners addRendererToParentViewRenderer addSceneLevelViews addSubView animateViews applyIdsToViewStructs applyInitialState applyLaunchArgs applyLayoutStateToNativeRenderer applyStateChanges assignBaseIOCServices begin beginAppLaunch bringChildInFrontOfChild bringChildToFront broadcastCurrentDesignResolutionToAsyncTasks broadcastSystemDeviceInfoEventToAsyncTasks buildView canChangeOrientation canMeasureBounds clearErrorByErrorField clearErrors configureAudioGuideItem configureIoC connectRemoteDebugClient containsChild createDataEvent createOrientationChangeEventFromMetrics dismiss dispatch dispatchAction dispatchAsync dispatchDeviceMetricsDidChange dispatchOrientationDidChange dispatchSelection executeHosannaCommand exitApp findNextFocusable findNextFocusableView findNextFocusableViewByDirection finishAppLaunch getAnimationPropsForStateProperty getAppDialogManager getAppMainMenu getAudioGuideItem getBounds getBoundsInApp getBoundsInParent getChangedField getChildView getCustomData getDesignResolutionChangeSource getDeviceMetricsState getField getFlattenedStructs getFlattenedStructsById getNavController getObservableField getOrientationChangeKey getOrientationController getPointInLocalCoordinates getSubView getSubViewRenderer getVisibleOrientationRoot handleInputEvent handleOrientationDidChange handleOrientationWillChange handleRuntimeDeviceMetricsDidChange handleSystemDeviceInfoEvent handleSystemMessageEvent hibernateView hideMainMenu inflateViewStructs initializeAsyncServices initializeClassRegistry initializeSystemMessageManager insertChild insertChildAfterOtherChild insertChildBeforeOtherChild insertSubView invalidateDeviceMetricsViews invalidateLayout invalidateOrientationView invalidateParentLayout isDescendantOf isInFocusChain layoutAt layoutChildren loadAppConfig loadShapes logAppHolderChildOrder markStateDirtyForViewManager notifyOnFocusedChildChange observeSceneDesignResolutionChanges onAppear onAppearAgain onBlur onCurrentDesignResolutionChanged onCurrentDesignResolutionFieldChanged onDidAddToAggregateView onDidAppearInAggregateView onDidChangeOrientation onDidReappearInAggregateView onDidRemoveFromAggregateView onDisappear onDisappearFromAggregateView onFirstAppear onFocus onInputEvent onMount onSystemEvent onUnmount onWillAddToAggregateView onWillApplyStateChanges onWillChangeOrientation onWillRemoveFromAggregateView onWillReuse performViewManagerLayoutChildren precreateSGViews preloadInstancePool prepareBackground prepareScene prepareSceneWeb present processRemoteDebugCommand reconcileChildren recycle refreshDeviceLayoutForMetrics registerControlWithErrorMessage registerControlWithKnownError registerInputAdapters release removeChild removeSubView render replaceRootView requestFocusedChild requestOrientationChange resolveAsyncCommandHandlerForDeviceUpdates resolveFocusEntryTarget resolveIOCDependencies restoreLostFocus sendChildBehindOtherChild sendChildToBack setChildIndex setError setField setFPS setLayoutField setObservableField setRootView setShowOnScreen setState showDialog showMainMenu startKeyboardInsetsService startOrientationController stopLoop supportsOrientationChange unlockOrientation unobserveObservableObjects wakeView

    Constructors

    Properties

    __isMemoizedStateValid: boolean = false
    _cacheKey: string = ''
    _hid: string = 'app'
    _isInFocusChain: boolean = false
    _oid?: string

    Optional object ID for this app instance.

    activeAnimation?: HosannaViewAnimator

    If present, an animation currently targeting this view (or its subviews).

    activeStyleViewStatus: ViewStatus = ViewStatus.Normal
    aggregateView: undefined | IAggregateView.IAggregateView

    IHosannaView


    appConfig: IAppConfig

    Convenience accessor to the app config.

    appHolderGroup: ISGNGroup

    The main app holder group node.

    audioGuideHint?: string = ''

    This hint can be used in conjunction with the audio guide item

    audioGuideItem?: string | IAudioGuideItem
    backgroundRectangle: ISGNRectangle

    The background rectangle node.

    calculatedHeight: number = 0
    calculatedWidth: number = 0
    calculatedX: number = 0
    calculatedY: number = 0
    canReceiveFocus: boolean = true

    Indicates whether the element can receive focus.

    children: BaseView.BaseView<ViewState, ISGNGroup>[] = []

    List of child views.

    childrenChanged: boolean = false
    clippingRect: number[] = ...
    compositeView: boolean = true

    Indicdates whether the view is a focus group which means it can have a focused child Otherwise it will be focused itself

    customData?: unknown
    defaultValues: Partial<T> = {}
    elapsedSinceLastFpsReset: number = 0

    Time elapsed since the last FPS reset.

    eventHandlers: Record<string, Function> = {}
    focusedChildId?: string
    focusId: string = ''

    Focus manager for handling focus across views.

    fps: number = 60

    Frames per second for the main loop.

    framesThisSecond: number = 0

    Number of frames rendered in the current second.

    height: number = 0
    id: string = 'app'

    Application ID.

    includeInLayout: boolean = true
    initialFocusId: string = ''
    instancePool: IInstancePool
    isFocused: boolean = false

    Indicates whether the element is currently focused.

    isLayoutDirty: boolean = false
    isLoopRunning: boolean = false
    isPresented: boolean = false

    If true, this view has been presented in an AggregateViewController

    isSkeleton: boolean = false
    isWaking: boolean = false
    keyboardAvoidance: "none" | "auto" = 'auto'

    Automatic keyboard avoidance opt-out. When a software keyboard appears, the framework translates the visible screen to keep the editing input in view; set 'none' on the screen or the input to disable. Plain field (not reactive) — checked at keyboard-show time.

    lastTickTime: number = 0

    Last tick time for the main loop.

    launchArgs: ILaunchArgs = {}
    loopIntervalId?: Timeout

    Interval ID for the main loop (web only).

    metricsHandledOrientationChangeKey?: string
    nativeGlass: undefined | SGNativeGlassEffect = undefined
    nextViewId: number = 0
    nodePool: INodePool

    Node pool for view management.

    opacity: number = 1.0
    orientationController?: IOrientationController
    parent?: IHosannaView<ViewState> = undefined
    partialRendererHibernatedState: Partial<T> = {}

    Remote debug client instance.

    rootView?: BaseView.BaseView<ViewState, ISGNGroup>

    The root view of the application.

    rotation: number = 0
    scale: number[] = ...
    scaleRotateCenter: number[] = ...
    scrollablePositionX: undefined | number = undefined
    scrollablePositionY: undefined | number = undefined
    staticType: ViewStaticType = ViewStaticType.None
    subViews: BaseView.BaseView<ViewState, ISGNGroup>[] = []

    List of subviews.

    subViewsChanged: boolean = false

    System service for platform/system-level operations.

    textToSpeechManager: ITextToSpeechManager

    Audio guide manager for handling audio guide events.

    Timer service for scheduling and ticking.

    translation: number[] = ...
    viewOwner: IHosannaView<ViewState>

    The IHosannaView subclass that created us in getViews

    viewStatus: ViewStatus = ViewStatus.Normal
    visible: boolean = true

    Indicates whether the navigatable entity is visible.

    width: number = 0

    Accessors

    • get renderer(): undefined | R

      Returns undefined | R

    • set renderer(value: undefined | R): void

      Parameters

      • value: undefined | R

      Returns void

    • get viewPhase(): ViewPhase

      Returns ViewPhase

    • set viewPhase(phase: ViewPhase): void

      Parameters

      Returns void

    Methods


    • Children


      Parameters

      • child: IHosannaView<ViewState>
      • OptionalmountTarget: IHosannaView<ViewState>

      Returns void

    • Parameters

      • children: IHosannaView<ViewState>[]

      Returns void

    • Adds the dialog manager view to the app. Sets up dialog event handlers.

      Returns void

    • Returns void

      Use registerInputAdapters() instead. Kept for backward compatibility. Adds mouse inspection event listeners to mainScene for interactive debugging.

    • Parameters

      • parent: undefined | IHosannaView<ViewState>
      • childIndex: number = -1

      Returns void

    • Adds scene-level views such as the app holder and dialog manager.

      Returns void


    • View Creation


      Parameters

      • view: IHosannaView<ViewState>

      Returns void

    • Parameters

      • nextViewStructs: undefined | ViewStruct<ViewState>[]
      • parentId: string = ""
      • level: number = 0

      Returns void

    • Returns void

    • Parameters

      • OptionalnextState: ViewState

      Returns void

    • Assigns base IoC services to the app instance. Used as a workaround for static-only injection on Roku.

      Returns void

    • Begins the application launch sequence. Initializes scene, IoC, views, and starts the main loop.

      Returns void

    • Called automatically at the start of the app launch sequence.

      Returns void

    • Parameters

      • child: IHosannaView<ViewState>
      • otherChild: IHosannaView<ViewState>

      Returns void

    • Parameters

      • child: IHosannaView<ViewState>

      Returns void

    • Parameters

      • update: undefined | IHosannaCurrentDesignResolution

      Returns void

    • Builds the view and attaches it to the view owner.

      Parameters

      • struct: ViewStruct<ViewState>
      • OptionalmountTarget: IHosannaView<ViewState>

        The target to mount the view.

      • childIndex: number = -1

      Returns undefined | IHosannaView<ViewState>

      The built view or undefined.

    • Parameters

      • event: HosannaOrientationChangeEvent

      Returns boolean

    • Parameters

      • errorField: IDebugErrorFieldMap

      Returns void

    • Configures the IoC container for the current platform.

      Returns void

    • Parameters

      • isWeb: boolean = false

      Returns void

    • Parameters

      • child: IHosannaView<ViewState>

      Returns boolean

    • Parameters

      • previous: HosannaDeviceMetricsState
      • current: HosannaDeviceMetricsState
      • source: HosannaOrientationChangeSource

      Returns HosannaOrientationChangeEvent

    • Parameters

      • Optionaloptions: IScreenDismissOptions

      Returns void

    • Type Parameters

      • T

      Parameters

      • command: string
      • Optionalargs: Record<string, unknown>
      • OptionalcancellationToken: HsCancellationToken
      • OptionaltaskId: string

      Returns HsPromise<T>

    • Parameters

      • previous: HosannaDeviceMetricsState
      • source: HosannaOrientationChangeSource
      • reasons: HosannaDeviceMetricsChangeReason[]
      • OptionalorientationEvent: HosannaOrientationChangeEvent

      Returns void

    • Parameters

      • event: HosannaOrientationChangeEvent
      • visibleRoot: undefined | IHosannaView<ViewState>

      Returns void

    • Executes a hosanna debug command by id. Public so RemoteDebugClient can invoke when it receives printHSTree, printSGTree, etc. via WebSocket.

      Parameters

      • commandId: string
      • Optionaldata: Record<string, unknown>

      Returns void

    • Returns void

    • Call this method to finish the app launch sequence.

      Returns void

    • Returns the main menu view for the app, if any. Override to provide your main menu view.

      Returns undefined | BaseView.BaseView<ViewState, ISGNGroup>

      The main menu view, or undefined if not present.


    • Measurement


      Returns I2DRectangle

    • Parameters

      • otherView: IHosannaView<ViewState>

      Returns I2DRectangle

    • Type Parameters

      • T extends IHosannaView<ViewState>

      Parameters

      • id: string

      Returns undefined | T

    • Parameters

      • update: undefined | IHosannaCurrentDesignResolution

      Returns HosannaOrientationChangeSource

    • Parameters

      • Optionalstate: Partial<HosannaOrientationState>

      Returns HosannaDeviceMetricsState

    • Type Parameters

      • K extends keyof ViewState

      Parameters

      • field: K

      Returns any

    • Parameters

      • nextStructs: ViewStruct<ViewState>[]

      Returns ViewStruct<ViewState>[]

    • Parameters

      • nextStructs: ViewStruct<ViewState>[]
      • map: Record<string, ViewStruct<ViewState>> = {}
      • idList: { childIndex: number; id: string }[] = []

      Returns {
          idList: { childIndex: number; id: string }[];
          mappedNextStructs: Record<string, ViewStruct<ViewState>>;
      }

    • Parameters

      • event: HosannaOrientationChangeEvent

      Returns string

    • Returns IOrientationController

    • Parameters

      • point: { x: number; y: number }

      Returns { x: number; y: number }


    • Rendererers


      Type Parameters

      • T extends IHosannaView<ViewState>

      Parameters

      • id: string
      • isDeepSearch: boolean = false

      Returns undefined | T

    • Returns undefined | IHosannaView<ViewState>

    • Parameters

      • event: HosannaOrientationChangeEvent

      Returns void

    • Parameters

      • event: HosannaOrientationChangeEvent

      Returns void

    • Parameters

      • source: HosannaOrientationChangeSource = 'system'
      • options: { configureDevice?: boolean; force?: boolean } = {}

      Returns void

    • Handles system message events sent from task threads. Forwards the message to SystemMessageManager for display.

      Parameters

      Returns void

    • Hibernates the view and its subviews by releasing native renderers and setting the view phase to Hibernating.

      Returns void

    • Hides the main menu, making it invisible and unfocusable.

      Parameters

      • animated: boolean = true

        Whether to animate the menu disappearance.

      Returns void

    • Parameters

      • nextViewStructs: ViewStruct<ViewState>[]

      Returns void

    • Initializes asynchronous services and prepopulates the async command pool.

      Returns HsPromise<void>

      A promise that resolves when async services are initialized.

    • Initializes the class registry for the current platform. Skips initialization on Roku (uses different reflection mechanism).

      Returns HsPromise<void>

      A promise that resolves when the class registry is initialized.

    • Returns void

    • Parameters

      • child: IHosannaView<ViewState>
      • OptionalmountTarget: IHosannaView<ViewState>
      • index: number = -1

      Returns void

    • Parameters

      • child: IHosannaView<ViewState>
      • otherChild: IHosannaView<ViewState>

      Returns void

    • Parameters

      • child: IHosannaView<ViewState>
      • otherChild: IHosannaView<ViewState>

      Returns void

    • Parameters

      • view: IHosannaView<ViewState>

        The view to be added as a subview.

      • index: number = -1

        index of the child in the parent view, -1 means add to end

      Returns void

    • Parameters

      • visibleRoot: undefined | IHosannaView<ViewState>

      Returns void

    • Parameters

      • view: undefined | IHosannaView<ViewState>
      • role: string

      Returns void

    • Parameters

      • view: IHosannaView<ViewState>

      Returns boolean

    • Parameters

      • x: number
      • y: number
      • parentWidth: number
      • parentHeight: number

      Returns void

    • Loads the application configuration, including style JSON.

      Returns HsPromise<void>

      A promise that resolves when the configuration is loaded.

    • Compiles theme.shapes into theme.compiledShapes.

      Runs automatically during the launch sequence, and can be called again at any time (e.g. after a theme/config reload — setConfig wipes theme.compiledShapes, so shapes must be reloaded). Fragments created before a reload must be recreated to pick up new shape styles.

      On Roku this waits for the imageGenerator task to pre-render each shape to a nine-patch image; on other platforms it resolves immediately.

      Returns HsPromise<void>

    • Parameters

      • reason: string

      Returns void

    • Returns void

    • Returns void

      Prefer BaseView.onDidAppearInAggregateView / BaseView.onDidReappearInAggregateView when shown via an aggregate transition. The framework still invokes this for other paths until migrated.

      IHosannaView.onAppear

    • Called when this view becomes the visible top again after having been covered by another screen on the same NavController (same transition finish as onAppear, immediately after it).

      Returns void

      Prefer overriding onDidReappearInAggregateView; default implementation chains from it.

    • DO NOT CALL THIS METHOD DIRECTLY DO NOT OVERRIDE IT

      Returns void

    • Parameters

      • update: undefined | IHosannaCurrentDesignResolution

      Returns void

    • Parameters

      • _event: HosannaOrientationChangeEvent

      Returns void

    • Returns void

      Prefer BaseView.onDisappearFromAggregateView when leaving an aggregate context during a transition. The framework still invokes this for other paths until migrated.

      IHosannaView.onDisappear

    • Called when this view becomes the visible top of a NavController stack for the first time for that controller (same transition finish as onAppear, immediately after it).

      Returns void

      Prefer overriding onDidAppearInAggregateView; default implementation chains from it.

    • DO NOT CALL THIS METHOD DIRECTLY DO NOT OVERRIDE IT

      Returns void


    • Lifecycle


      Parameters

      • parent: IHosannaView<ViewState> | BaseApp.BaseApp
      • childIndex: number = -1

      Returns void

    • Parameters

      • event: hosanna_api.ISystemEvent

        Event which was processed in main.brs On Web emulator, this is called directly from the Brs classes that dispatch the event. e.g. roAudioGuide, will call HosannaAppUtils.getApp().onSystemEvent(event);

      Returns unknown

    • This method is called before applying state changes to the view. It is used to perform any necessary preparations before the state changes are applied.

      Returns void

    • Parameters

      • _event: HosannaOrientationChangeEvent

      Returns void

    • Called by InstancePool.get() before a pooled instance is handed out. Restores the view to a construction-equivalent state so that stale lifecycle data (focus, viewStatus, old text, dirty flags, etc.) from the previous owner does not bleed into the new one.

      Class-default

      Returns void

      values (captured on first construction into the InstancePool per-class-name registry) are placed into pendingState with state left empty — matching a freshly-constructed view. This guarantees that every subsequent setField call (in applyInitialState) detects a difference against the empty state and pushes the value into pendingState, so applyLayoutStateToNativeRenderer applies ALL layout props (opacity, visible, translation, …) to the newly-acquired renderer even when the logical value equals the class default.

    • Pre-creates SceneGraph (SG) views and populates the node pool.

      Returns HsPromise<void>

      A promise that resolves when SG views are pre-created.

    • Prepares the background rectangle for the app. Creates and inserts a rectangle node if not already present.

      Returns void

    • Prepares the main scene for the app. Sets up scene properties and renderer.

      Returns void

    • Mounts the scene in web environments.

      Returns void

    • Presents a new screen in the navigation stack or as a dialog.

      Parameters

      • screen: ViewStruct<ViewState>

        The screen to be presented, represented by a ViewStruct<ViewState>.

      • Optionaloptions: IScreenPresentationOptions

        Optional presentation options.

        • isDialog

          If true, the screen will be presented as a dialog.

        • animated

          If true, the screen transition will be animated.

      Returns void

    • Parameters

      • nextStructs: ViewStruct<ViewState>[]

      Returns void


    • IReusable implementation


      Parameters

      • initialState: ViewState

      Returns void

    • Returns boolean

    • Parameters

      • message: string
      • errorField: IDebugErrorFieldMap

      Returns void

    • Parameters

      • message: string
      • errorField: IDebugErrorFieldMap

      Returns void

    • Registers input adapters for the current platform. Web gets keyboard + debug + mouse + touch adapters. Uses PlatformAppInitializer to avoid cross-platform import issues.

      Returns void

    • Parameters

      • child: IHosannaView<ViewState>

      Returns void

    • Parameters

      • view: IHosannaView<ViewState>

      Returns void

    • Parameters

      • changes: Partial<T>

      Returns void

    • Replaces the current root view with a new one.

      Parameters

      Returns void

    • Sets which direct child this composite prefers on the next focus cascade, or moves focus to that child if this view is already in the focus chain.

      • First / Last: first or last direct child in children order with canReceiveFocus && visible.
      • Default: clears focusedChildId only (next cascade uses getInitialFocusId()); does not call setFocus.
      • Specific: same behavior as setFocusedSubview for a known child id.

      Parameters

      • target: ChildFocusTarget
      • OptionalchildId: string

      Returns void

    • Parameters

      • target: string
      • Optionaloptions: HosannaOrientationChangeOptions

      Returns HsPromise<boolean>

    • Resolves system-level IoC dependencies and registers services. CRITICAL: Resolve services in dependency order - services that other services depend on must be resolved first. For example, TimerService depends on systemService, so systemService must be resolved before timerService.

      Returns void

    • Parameters

      • child: IHosannaView<ViewState>
      • otherChild: IHosannaView<ViewState>

      Returns void

    • Parameters

      • child: IHosannaView<ViewState>

      Returns void

    • Changes the visual z-order of a child by moving it to a new index. Higher indices render on top. Updates both the children array and the renderer. Requires removeChild before insertChild because the SG node's insertChild always adds (splices in) and does not move; calling it on an already-present child would duplicate.

      Parameters

      • child: IHosannaView<ViewState>
      • newIndex: number

      Returns void

    • Parameters

      • errorObj: IDebugErrorObject

      Returns void

    • Type Parameters

      • K extends keyof ViewState

      Parameters

      • field: K
      • value: ViewState[K]

      Returns void

    • Sets the frames per second for the main loop.

      Parameters

      • fps: number

        The desired frames per second.

      Returns void

    • Type Parameters

      • K extends keyof ViewState

      Parameters

      • field: K
      • value: ViewState[K]

      Returns void

    • Parameters

      • key: string
      • newVal: unknown

      Returns void


    • Navigatable View


      Parameters

      • shown: boolean

      Returns void

    • Parameters

      • state: Partial<T>

      Returns void

    • Shows a dialog by passing it to the dialog manager.

      Parameters

      • dialogView: ViewStruct<ViewState>

        The dialog view to show.

      Returns void

    • Shows the main menu, making it visible and focusable.

      Parameters

      • animated: boolean = true

        Whether to animate the menu appearance.

      Returns void

    • Returns void

    • Returns void

    • Stops the main application loop.

      Returns void

    • Parameters

      • target: string

      Returns boolean

    • Wakes up the view and its subviews by reserving native renderers and setting the view phase to Mounted.

      Returns void