MCPcopy Index your code
hub / github.com/NativeScript/firebase / Query

Class Query

packages/firebase-database/index.android.ts:146–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146export class Query implements IQuery {
147 _native: com.google.firebase.database.Query;
148 static fromNative(query: com.google.firebase.database.Query) {
149 if (query instanceof com.google.firebase.database.Query) {
150 const q = new Query();
151 q._native = query;
152 return q;
153 }
154 return null;
155 }
156
157 get native() {
158 return this._native;
159 }
160 get android() {
161 return this.native;
162 }
163
164 get ref(): Reference {
165 return Reference.fromNative(this.native.getRef());
166 }
167
168 endAt(value: string | number | boolean, key?: string): Query {
169 if (key) {
170 return Query.fromNative(this.native.endAt(value as any, key as any));
171 } else {
172 return Query.fromNative(this.native.endAt(value as any));
173 }
174 }
175 equalTo(value: string | number | boolean, key?: string): Query {
176 if (key) {
177 return Query.fromNative(this.native.equalTo(value as any, key));
178 } else {
179 return Query.fromNative(this.native.equalTo(value as any));
180 }
181 }
182 keepSynced(bool: boolean) {
183 this.native?.keepSynced?.(bool);
184 }
185 limitToFirst(limit: number): Query {
186 return Query.fromNative(this.native.limitToFirst(limit));
187 }
188 limitToLast(limit: number): Query {
189 return Query.fromNative(this.native.limitToLast(limit));
190 }
191 off(eventType?: EventType, callback?: (a: DataSnapshot, b: string) => void, context?: Record<string, any>): void {
192 const handle = callback?.['__fbHandle'];
193 const event = callback?.['__fbEventType'];
194 if (handle && event === eventType) {
195 if (this._handles.has(callback)) {
196 this.native.removeEventListener(handle as any);
197 callback['__fbHandle'] = undefined;
198 callback['__fbEventType'] = undefined;
199 callback['__fbContext'] = undefined;
200 this._handles.delete(callback);
201 }
202 }
203 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…