Interface GeolocationResult
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
GeolocationError,GeolocationPending,GeolocationPosition
public sealed interface GeolocationResult
extends Serializable
permits GeolocationPending (not exhaustive)
The value held by
GeolocationWatcher.positionSignal() — a successful
reading, an error, or the initial "waiting for first reading" state. Always
exactly one of:
GeolocationPending— initial state, before the browser has reported anything.GeolocationPosition— a successful reading.GeolocationError— the browser reported an error.
switch (watcher.positionSignal().get()) {
case GeolocationPending p -> showSpinner();
case GeolocationPosition pos -> map.setCenter(pos.coords());
case GeolocationError err -> showError(err.errorCode());
}