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

    AsyncManager is responsible for managing the lifecycle and execution of asynchronous commands and events.

    • Handles command registration, dispatch, completion, and cancellation.
    • Integrates with platform-specific task nodes and message ports.
    • Manages event queues and dispatchers for async event delivery.
    • Loads and instantiates command handlers dynamically by scope.

    Implements

    Index

    Constructors

    Properties

    commandHandlerClazzByScope: Record<string, any> = {}

    Map of command handler classes by scope.

    commandHandlersByScope: Record<string, any> = {}

    Instantiated command handlers by scope.

    commandRegistry: Map<string, IAsyncCommand<unknown>> = ...

    Registry of active async commands by ID.

    Dispatcher for sending async events to the appropriate task node.

    Queue for managing async events.

    fpsTimer: ISGROTimespan

    Timer for measuring frame deltas.

    functionMap: Record<string, string> = {}

    Map of function names by scope.

    isRunningWebLoop: boolean = false

    Guard flag to prevent recursive calls to runWebLoop.

    loopFrequency: number = ...

    Loop frequency in milliseconds for the main loop.

    port: ISGROMessagePort

    Message port for receiving commands (Roku platform).

    runInterval?: unknown

    Interval handle for the web run loop.

    Injected system service for ticking system-level operations.

    taskId: string

    The task ID extracted from taskNode.id (e.g., "analytics-1", "default-0").

    taskNode: ISGNTask

    The task node associated with this manager.

    Injected timer service for ticking timer-based operations.

    Methods

    • Parameters

      • command: IAsyncCommand<{ update?: IHosannaCurrentDesignResolution }>

      Returns void

    • Cancels a command by its ID, invoking its cancellation token and removing it from the registry.

      Parameters

      • commandId: string

        The ID of the command to cancel.

      Returns void

    • Sets up observers and starts the run loop for Web/Apple platforms. Uses render-thread emulation via setInterval (polyfilled on Apple).

      Returns void

    • Returns void

      Use emulateTaskOnRenderThread() instead Kept for backwards compatibility

    • Initializes the async environment, registering fetch, event dispatcher, and event queue.

      Returns void

    • Loads the handler map and function map for command dispatching.

      Returns Promise<void>

    • Processes an incoming async command, instantiating and invoking the appropriate handler.

      Parameters

      Returns void

    • Processes any existing command on the task node before the observer is set up. This handles the race condition where a command is dispatched before the observer is ready.

      Returns void

    • Registers a command in the command registry and assigns a cancellation token.

      Parameters

      Returns void

    • Returns undefined | IHosannaDeviceUpdateManager

    • Starts the main loop for processing async commands and events. Adapts to Roku, Web, or Apple platform.

      Returns void

    • Main loop for ticking system and timer services, and processing commands (Roku).

      Returns void

    • Main loop for ticking system and timer services (Web/Apple). Protected against recursive calls to prevent stack overflow.

      Returns void