import { BehaviorSubject } from 'rxjs'; import { BehaviorSubjectable } from '../abstract/behavior.subjectable'; /** * UserLocation * ============ * * ## Usage * * ```typescript * import { * UserLocationSubject * } from '@mralexandernickel/frontend-subjects/dist/user.location/user.location'; * * export default new UserLocationSubject( * YOUR_GOOGLE_MAPS_API_KEY, * THE_GOOGLE_MAPS_API_ENDPOINT, * A_FALLBACK_URL_TO_A_GEOIP_RESPONSE * ); * ``` * * ```typescript * import UserLocation from './UserLocation'; * UserLocation.get().subscribe(userLocation => { * console.log('UserLocation is now:', userLocation); * }); * ``` */ export declare class UserLocationSubject extends BehaviorSubjectable { private mapsApiKey; private mapsApiEndpoint; private geoipEndpoint; /** * @constructor */ constructor(mapsApiKey: string, mapsApiEndpoint: string, geoipEndpoint: string); /** * Public method to get the users position */ get(): BehaviorSubject; /** * Save users position to locastorage an publish to subject * @param lat latitude * @param lng longitude * @param country country */ private saveAndSendPosition; /** * Get the user position by geolocation if user allows it, otherwise fall back * to a geoip solution */ private queryPosition; /** * Get the user location from localstorage if already existent, otherwise request it */ private getUserLocation; }