Skip to content

Commit d697fa0

Browse files
committed
Add interface GeocodingContext
See #339.
1 parent 4eb5e16 commit d697fa0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/geocoders/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ export interface IGeocoder {
4747
/**
4848
* Performs a geocoding query and returns the results as promise
4949
* @param query the query
50+
* @param context the context for the query
5051
*/
5152
geocode(query: string, context?: GeocodingContext): Promise<GeocodingResult[]>;
5253
/**
5354
* Performs a geocoding query suggestion (this happens while typing) and returns the results as promise
5455
* @param query the query
56+
* @param context the context for the query
5557
*/
5658
suggest?(query: string, context?: GeocodingContext): Promise<GeocodingResult[]>;
5759
/**

src/geocoders/photon.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import * as L from 'leaflet';
22
import { getJSON } from '../util';
3-
import { IGeocoder, GeocoderOptions, geocodingParams, GeocodingResult, reverseParams } from './api';
3+
import {
4+
GeocoderOptions,
5+
GeocodingContext,
6+
geocodingParams,
7+
GeocodingResult,
8+
IGeocoder,
9+
reverseParams
10+
} from './api';
411

512
export interface PhotonOptions extends GeocoderOptions {
613
reverseUrl: string;
@@ -22,7 +29,7 @@ export class Photon implements IGeocoder {
2229
L.Util.setOptions(this, options);
2330
}
2431

25-
async geocode(query: string, context?: { map?: L.Map }): Promise<GeocodingResult[]> {
32+
async geocode(query: string, context?: GeocodingContext): Promise<GeocodingResult[]> {
2633
const params = geocodingParams(this.options, { q: query });
2734
const center = context?.map?.getCenter?.();
2835
if (center) {

0 commit comments

Comments
 (0)