mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-17 07:20:23 +00:00
Merge pull request #8491 from Benefex/master
Updated firebase query method .once to optionally return a promise
This commit is contained in:
@@ -700,11 +700,18 @@ wilmaRef.transaction(function(currentData) {
|
||||
}, { x: 1 });
|
||||
}
|
||||
|
||||
() => {
|
||||
// Use a Promise in place of a callback
|
||||
firebaseRef.once('value').then(function(dataSnapshot){
|
||||
// handle read data
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.orderByChild()
|
||||
*/
|
||||
() => {
|
||||
// For example, using our sample Firebase of dinosaur facts,
|
||||
// For example, using our sample Firebase of dinosaur facts,
|
||||
// we can read all dinosaurs ordered by height using the following query:
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByChild("height").on("child_added", function (snapshot) {
|
||||
|
||||
Vendored
+1
@@ -109,6 +109,7 @@ interface FirebaseQuery {
|
||||
*/
|
||||
once(eventType: string, successCallback: (dataSnapshot: FirebaseDataSnapshot) => void, context?: Object): void;
|
||||
once(eventType: string, successCallback: (dataSnapshot: FirebaseDataSnapshot) => void, failureCallback?: (error: any) => void, context?: Object): void;
|
||||
once(eventType: string): Promise<FirebaseDataSnapshot>
|
||||
/**
|
||||
* Generates a new Query object ordered by the specified child key.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user