Created
April 3, 2018 12:12
-
-
Save shriharip/b555ed812601db223c8aef2c98ed7edb to your computer and use it in GitHub Desktop.
geofire typings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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