eligius
    Preparing search index...

    Class BasePositionSourceAbstract

    Abstract base class for position sources.

    Provides shared state management, lifecycle handling, and callback registration for concrete position source implementations.

    Subclasses must implement:

    • doInit() - Source-specific initialization
    • doDestroy() - Source-specific cleanup
    • startTicking() - Start emitting position updates
    • stopTicking() - Stop emitting position updates
    class MyPositionSource extends BasePositionSource {
    protected doInit(): Promise<void> {
    // Initialize resources
    return Promise.resolve();
    }

    protected doDestroy(): void {
    // Clean up resources
    }

    protected startTicking(): void {
    // Start position updates
    }

    protected stopTicking(): void {
    // Stop position updates
    }
    }

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Accessors

    • get loop(): boolean

      Whether to loop when reaching the end boundary.

      When true, the source resets to position 0 and continues. When false, the source emits 'end' boundary and deactivates.

      For sources where looping is not applicable (e.g., mouse position), this property has no effect.

      Returns boolean

    • set loop(value: boolean): void

      Whether to loop when reaching the end boundary.

      When true, the source resets to position 0 and continues. When false, the source emits 'end' boundary and deactivates.

      For sources where looping is not applicable (e.g., mouse position), this property has no effect.

      Parameters

      • value: boolean

      Returns void

    Methods

    • Initialize the position source.

      Performs any async setup required before the source can be activated. For example: loading media, binding event listeners, establishing connections.

      Returns Promise<void>

      If initialization fails (e.g., media load error, connection refused)

    • Register a callback for when the source becomes active.

      Called once each time the source transitions to the active state. This is equivalent to "first frame" semantics - for RAF sources it's the first tick, for video sources it's when playback actually starts.

      Parameters

      • callback: () => void

        Function called when source becomes active

      Returns void

    • Register a callback for position updates.

      Called whenever the position changes while the source is active. Frequency depends on the source type (e.g., RAF tick, video timeupdate).

      Parameters

      • callback: (position: number) => void

        Function receiving the current position

      Returns void