fake-geolocation
    Preparing search index...

    Interface GeolocationObserver

    An observer for geolocation changes.

    interface GeolocationObserver {
        waitForCoordinates: (
            matcherOrMatchers?:
                | Partial<GeolocationCoordinatesParameters>
                | Partial<GeolocationCoordinatesParameters>[],
            task?: () => Promise<void>,
            positionOptions?: PositionOptions,
        ) => Promise<void>;
        waitForPermissionState: (
            stateOrStates: PermissionState | PermissionState[],
            task?: () => Promise<void>,
        ) => Promise<void>;
        waitForPositionError: (
            codeOrCodes?:
                | GeolocationPositionErrorCode
                | GeolocationPositionErrorCode[],
            task?: () => Promise<void>,
            positionOptions?: PositionOptions,
        ) => Promise<void>;
    }
    Index

    Properties

    waitForCoordinates: (
        matcherOrMatchers?:
            | Partial<GeolocationCoordinatesParameters>
            | Partial<GeolocationCoordinatesParameters>[],
        task?: () => Promise<void>,
        positionOptions?: PositionOptions,
    ) => Promise<void>

    Wait for the geolocation coordinates to match one of the supplied matchers.

    Watches the geolocation position with the Geolocation API supplied to createGeolocationObserver and resolves when coordinates are acquired that match one of the supplied matchers.

    The acquired coordinates must match all properties of at least one supplied matcher in order to be considered a match. If no matchers are supplied, then any acquired coordinates will be considered a match.

    Type declaration

    waitForPermissionState: (
        stateOrStates: PermissionState | PermissionState[],
        task?: () => Promise<void>,
    ) => Promise<void>

    Wait for the geolocation permission state to change to one of the specified states.

    Type declaration

      • (
            stateOrStates: PermissionState | PermissionState[],
            task?: () => Promise<void>,
        ): Promise<void>
      • Parameters

        • stateOrStates: PermissionState | PermissionState[]

          The desired permission state(s).

        • Optionaltask: () => Promise<void>

          An optional task to execute while waiting for the state change. You can use this to guarantee that certain actions are performed after observation has started.

        Returns Promise<void>

        A promise that resolves when the geolocation permission state matches one of the desired states. If the state is already one of the desired states, the promise resolves immediately.

    A TypeError if no states are provided.

    waitForPositionError: (
        codeOrCodes?:
            | GeolocationPositionErrorCode
            | GeolocationPositionErrorCode[],
        task?: () => Promise<void>,
        positionOptions?: PositionOptions,
    ) => Promise<void>

    Wait for the geolocation position error to match one of the supplied GeolocationPositionError.code codes.

    Watches the geolocation position with the Geolocation API supplied to createGeolocationObserver and resolves when a position error is received that has a code that is one of the supplied codes.

    If no codes are supplied, then any received position error will be considered a match.

    Type declaration