fixed typo in rtdb get node and added auto setup for firestore and rtdb get
This commit is contained in:
@ -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": {
|
||||||
|
|||||||
@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user