Skip to content

Instantly share code, notes, and snippets.

@shriharip
Created April 3, 2018 12:12
Show Gist options
  • Save shriharip/b555ed812601db223c8aef2c98ed7edb to your computer and use it in GitHub Desktop.
Save shriharip/b555ed812601db223c8aef2c98ed7edb to your computer and use it in GitHub Desktop.
geofire typings
declare module 'geofire' {
type EventType = 'ready' | 'key_entered' | 'key_exited' | 'key_moved';
interface GeoQueryCriteria {
center: number[];
radius: number;
}
interface GeoQueryUpdateCriteria {
center?: number[];
radius?: number;
}
interface GeoCallbackRegistration {
cancel();
}
interface GeoQuery {
center(): number[];
radius(): number;
updateCriteria(criteria: GeoQueryUpdateCriteria);
on(eventType: EventType, callback: (key:string, location: number[], distance: number) => void): GeoCallbackRegistration;
cancel();
}
class GeoFire {
constructor(ref: any);
ref(): any;
set(key: string, loc: number[]): Promise<void>;
get(key: string): Promise<number[]>;
remove(key: string): Promise<void>;
query(criteria: GeoQueryCriteria): GeoQuery;
static distance(location1: number[], location2: number[]);
}
export = GeoFire;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment