InterfacePositionProvider

An interface for objects that provide a position.

This interface allows objects to provide a position that can change over time, with subscribers being notified of changes.

interface PositionProvider {
    currentPosition: null | Position;
    subscribeToPosition(callback: ((position: null | Position) => void)): (() => void);
}

Implemented by

Properties

currentPosition: null | Position

The current position.

A null value indicates that the position is not available.

Methods

  • Subscribes to position updates.

    Parameters

    • callback: ((position: null | Position) => void)

      The callback to call when the position changes.

        • (position): void
        • Parameters

          Returns void

    Returns (() => void)

    A function to unsubscribe from the position updates.

      • (): void
      • Returns void

    The callback function is not called until the position provider produces a new position: use currentPosition to get the current position.