Static properties and methods related to geolocation handling.

Constructors

Methods

  • Clear watcher by given ID.

    Parameters

    • watchId: number

      ID of watcher

    Returns void

  • Get the current user position.

    Parameters

    • options: {
          enableHighAccuracy?: boolean;
          requestNewPosition?: boolean;
          roundResultTo?: number;
          supressErrorMessage?: boolean;
      }

      Options for the geolocation request.

      • OptionalenableHighAccuracy?: boolean

        Use GPS support if possible (increase accuracy).

      • OptionalrequestNewPosition?: boolean

        Requests a new position. If set to false, the last saved position (if not older than 5 minutes) is returned.

      • OptionalroundResultTo?: number

        Round the result of latitude and longitude to given count.

      • OptionalsupressErrorMessage?: boolean

        Supresses error message when position request ran in error or timeout.

    Returns Promise<IHFLocation>

  • Watch the current user position. And returns watcher ID.

    Parameters

    • success: (result: IHFLocation) => void

      callback function that takes a IHFLocation object as an input parameter.

    • error: (error: any) => void

      callback function that takes an error object as an input parameter.

    • options: {
          audioFeedback?: boolean;
          enableHighAccuracy?: boolean;
          requestNewPosition?: boolean;
          roundResultTo?: number;
          supressErrorMessage?: boolean;
          watchTimeout?: number;
      }

      Options for the geolocation request.

      • OptionalaudioFeedback?: boolean

        Enable audio feedback on every successful fetch of new location data.

      • OptionalenableHighAccuracy?: boolean

        Use GPS support if possible (increase accuracy).

      • OptionalrequestNewPosition?: boolean

        Force to request always new position.

      • OptionalroundResultTo?: number

        Round the result of latitude and longitude to given count.

      • OptionalsupressErrorMessage?: boolean

        Supresses error message when position request ran in error or timeout.

      • OptionalwatchTimeout?: number

        Quit watcher after given time (milliseconds).

    Returns number

    watcher ID