serialized-query
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -7,4 +7,4 @@ /// <reference types="firebase" /> | ||
export declare function slashNotation(path: string): string; | ||
export declare class SerializedQuery { | ||
static path(path: string | LazyPath): SerializedQuery; | ||
export declare class SerializedQuery<T = any> { | ||
static path(path: string | LazyPath): SerializedQuery<any>; | ||
protected _db: ISimplifiedDBAdaptor; | ||
@@ -19,2 +19,3 @@ protected _path: string | LazyPath; | ||
protected _equalTo: string; | ||
protected _handleSnapshot: (snap: FirebaseDataSnapshot) => any; | ||
constructor(path: string | LazyPath); | ||
@@ -31,4 +32,5 @@ limitToFirst(num: number): this; | ||
deserialize(db?: ISimplifiedDBAdaptor): FirebaseQuery; | ||
execute(db?: ISimplifiedDBAdaptor): Promise<FirebaseDataSnapshot>; | ||
handleSnapshot(fn: (snap: FirebaseDataSnapshot) => any): void; | ||
execute(db?: ISimplifiedDBAdaptor): Promise<any>; | ||
private validateNoKey(caller, key); | ||
} |
@@ -100,2 +100,5 @@ "use strict"; | ||
} | ||
handleSnapshot(fn) { | ||
this._handleSnapshot = fn; | ||
} | ||
execute(db) { | ||
@@ -106,3 +109,6 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
return this.deserialize(db).once('value'); | ||
const snap = yield this.deserialize(db).once('value'); | ||
return this._handleSnapshot | ||
? this._handleSnapshot(snap) | ||
: snap; | ||
}); | ||
@@ -109,0 +115,0 @@ } |
{ | ||
"name": "serialized-query", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A simple Typescript class to serialize Firebase queries", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
11599
153