webdev-power-kit
Version:
A powerful toolkit that simplifies access to browser features like clipboard, notifications, battery, vibration, and more — perfect for modern web developers.
28 lines (27 loc) • 861 B
TypeScript
export interface Coordinates {
latitude: number;
longitude: number;
accuracy?: number;
altitude?: number | null;
heading?: number | null;
speed?: number | null;
timestamp: number;
}
export interface LocationOptions {
enableHighAccuracy?: boolean;
timeout?: number;
maximumAge?: number;
}
/**
* Get current geolocation from user's device.
*/
export declare function getCurrentLocation(options?: LocationOptions): Promise<Coordinates>;
/**
* Continuously track user location.
* @returns Watch ID to use with clearLocationWatch()
*/
export declare function watchLocation(callback: (location: Coordinates) => void, errorCallback?: (error: GeolocationPositionError) => void, options?: LocationOptions): number;
/**
* Clear a location watch using its ID.
*/
export declare function clearLocationWatch(id: number): void;