in packages/geofire/src/GeoQuery.ts [92:114]
constructor(private _firebaseRef: DatabaseTypes.Reference, queryCriteria: QueryCriteria) {
// Firebase reference of the GeoFire which created this query
if (Object.prototype.toString.call(this._firebaseRef) !== '[object Object]') {
throw new Error('firebaseRef must be an instance of Firebase');
}
// Every ten seconds, clean up the geohashes we are currently querying for. We keep these around
// for a little while since it's likely that they will need to be re-queried shortly after they
// move outside of the query's bounding box.
this._cleanUpCurrentGeohashesQueriedInterval = setInterval(() => {
if (this._geohashCleanupScheduled === false) {
this._cleanUpCurrentGeohashesQueried();
}
}, 10000);
// Validate and save the query criteria
validateCriteria(queryCriteria, true);
this._center = queryCriteria.center;
this._radius = queryCriteria.radius;
// Listen for new geohashes being added around this query and fire the appropriate events
this._listenForNewGeohashes();
}