reference : https://npmjs.org/package/JQDeferred
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function getBIDS(NodeKey) {
var def = Deferred();
var read2DB = new Firebase("https://" + baseURL + "/BIDS");
read2DB.child(NodeKey).once('value', function(snap) {
def.resolve(snap);
});
return def.promise();
}
//callback
getBIDS("-JDQ0Ba4ZfC1CJxHduNZ").done(function(e){
console.log(e.val().debugfield);
});
origin - http://www.pipiscrew.com/?p=707 nodejs-using-jqdeferred-with-firebase