Home Reference Source
import GeolocationUtils from '@orloxx/ui-core/src/utils/geolocation.js'
public class | source

GeolocationUtils

Geolocation utilities

Static Method Summary

Static Public Methods
public static

disable(watcher: number)

unregister location/error monitoring handlers previously installed using GeolocationUtils.enable

public static

distance(lat1: number, lng1: number, lat2: number, lng2: number): number

Calculates the distance between two points on Earth

public static

enable(callback: Function, errorCallback: Function): number

Registers a handler function that will be called automatically each time the position of the device changes.

public static

getCurrent(callback: Function, errorCallback: Function)

Gets the current position of the device.

Static Public Methods

public static disable(watcher: number) source

unregister location/error monitoring handlers previously installed using GeolocationUtils.enable

Params:

NameTypeAttributeDescription
watcher number

Watch ID value returned by GeolocationUtils.enable

See:

public static distance(lat1: number, lng1: number, lat2: number, lng2: number): number source

Calculates the distance between two points on Earth

Params:

NameTypeAttributeDescription
lat1 number

Point's A latitude

lng1 number

Point's A longitude

lat2 number

Point's B latitude

lng2 number

Point's B longitude

Return:

number

The distance in meters

public static enable(callback: Function, errorCallback: Function): number source

Registers a handler function that will be called automatically each time the position of the device changes. You can also, optionally, specify an error handling callback function.

Params:

NameTypeAttributeDescription
callback Function

Takes a Position object as an input parameter.

errorCallback Function

Takes a PositionError object as an input parameter.

Return:

number

A watch ID value that then can be used to unregister the handler using GeolocationUtils.disable

See:

public static getCurrent(callback: Function, errorCallback: Function) source

Gets the current position of the device.

Params:

NameTypeAttributeDescription
callback Function

Takes a Position object as an input parameter.

errorCallback Function

Takes a PositionError object as an input parameter.

See: