File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 11import * as L from 'leaflet' ;
22import { Nominatim } from './geocoders/index' ;
3- import { IGeocoder , GeocodingResult } from './geocoders/api' ;
3+ import { IGeocoder , GeocodingResult , GeocodingContext } from './geocoders/api' ;
44
55export interface GeocoderControlOptions extends L . ControlOptions {
66 /**
@@ -316,7 +316,7 @@ export class GeocoderControl extends EventedControl {
316316 const event : StartGeocodeEvent = { input : value } ;
317317 this . fire ( suggest ? 'startsuggest' : 'startgeocode' , event ) ;
318318
319- const context = { map : this . _map } ;
319+ const context : GeocodingContext = { map : this . _map } ;
320320 const results = suggest
321321 ? await this . options . geocoder ! . suggest ! ( value , context )
322322 : await this . options . geocoder ! . geocode ( value , context ) ;
Original file line number Diff line number Diff line change 11import * as L from 'leaflet' ;
22
3+ /**
4+ * Context for geocoding operations
5+ */
6+ export interface GeocodingContext {
7+ /**
8+ * The map instance
9+ */
10+ map : L . Map ;
11+ }
12+
313/**
414 * An object that represents a result from a geocoding query
515 */
@@ -38,12 +48,12 @@ export interface IGeocoder {
3848 * Performs a geocoding query and returns the results as promise
3949 * @param query the query
4050 */
41- geocode ( query : string ) : Promise < GeocodingResult [ ] > ;
51+ geocode ( query : string , context ?: GeocodingContext ) : Promise < GeocodingResult [ ] > ;
4252 /**
4353 * Performs a geocoding query suggestion (this happens while typing) and returns the results as promise
4454 * @param query the query
4555 */
46- suggest ?( query : string ) : Promise < GeocodingResult [ ] > ;
56+ suggest ?( query : string , context ?: GeocodingContext ) : Promise < GeocodingResult [ ] > ;
4757 /**
4858 * Performs a reverse geocoding query and returns the results as promise
4959 * @param location the coordinate to reverse geocode
You can’t perform that action at this time.
0 commit comments