fixed typo in rtdb get node and added auto setup for firestore and rtdb get

This commit is contained in:
Peter Svensson
2019-07-12 15:31:30 +02:00
parent d353f02b6f
commit e9de7bf131
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-firebase-admin", "name": "node-red-contrib-firebase-admin",
"version": "1.1.1", "version": "1.1.2",
"description": "A node-red module that wraps the server-side admin SDK of firebase, firestore, et.c.", "description": "A node-red module that wraps the server-side admin SDK of firebase, firestore, et.c.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -9,15 +9,15 @@ module.exports = function(RED) {
var node = this; var node = this;
const cb = (res)=>{ const cb = (res)=>{
//console.log('firebase get result '+res) console.log('firebase get result '+res)
//console.dir(res) console.dir(res)
let val = res.val() let val = res.val()
//console.log('val='+val) //console.log('val='+val)
node.send({payload:val}) node.send({payload:val})
} }
let setUpListener = (path)=>{ let setUpListener = (path)=>{
//console.log('rtdb-get setUpListener for path '+path) console.log('rtdb-get setUpListener for path '+path)
if(oldpath){ if(oldpath){
this.admin.database().ref(oldpath).off('value', cb) this.admin.database().ref(oldpath).off('value', cb)
} }