# LocationProvider

Finds the user's location. Nothing happens, and no permission prompt appears,
until `locate` or `watch` is called from a user action. Implementations throw
`LocationError` or `PortAbortError`.

This is an interface exported by `@mapcairn/core`, checked against version 0.2.0.

## Signature

```ts
import type { LocationProvider } from "@mapcairn/core";
 
interface LocationProvider
```

## Properties

### supportsWatch

```ts
readonly supportsWatch: boolean;
```

Whether `watch` is available.

## Methods

### locate

```ts
locate(options?: LocateOptions): Promise<LocationFix>;
```

Finds the position once. Call it only from a user action, because the browser may ask for permission.

- `options?` (`LocateOptions`)

### watch

```ts
watch?(handlers: LocationWatchHandlers, options: {
        readonly signal: AbortSignal;
    }): void;
```

Starts watching until the signal fires. Present only when `supportsWatch`.

- `handlers` (`LocationWatchHandlers`)
- `options` (`{
        readonly signal: AbortSignal;
    }`)

## See also

- [`LocateOptions`](https://docs.mapcairn.com/api/core/LocateOptions.md)
- [`LocationFix`](https://docs.mapcairn.com/api/core/LocationFix.md)
- [`LocationWatchHandlers`](https://docs.mapcairn.com/api/core/LocationWatchHandlers.md)

Source: [packages/core/src/ports/location.ts:36](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/ports/location.ts#L36)
