【发布时间】:2019-02-12 21:14:39
【问题描述】:
我正在尝试将数据发送到 Firebase。函数执行后数据保存到数据库中,函数执行过程中如何覆盖?
import firebase from 'firebase';
var config = {
apiKey: "xxx",
authDomain: "xxx.firebaseapp.com",
databaseURL: "https://xxx.firebaseio.com",
projectId: "xxx",
storageBucket: "xxx.appspot.com",
messagingSenderId: "xxx"
};
firebase.initializeApp(config);
var db = firebase.database();
var sleep = require('sleep');
function run(TIME) {
db.ref('/test/').child('status').set('1');
sleep.sleep(TIME);
db.ref('/test/').child('status').set('2');
sleep.sleep(TIME);
db.ref('/test/').child('status').set('3');
sleep.sleep(TIME);
db.ref('/test/').child('status').set('4');
};
//========================================<<<< Now I see status in Firebase
run(5);
【问题讨论】:
-
您能否更详细地解释您要达到的目标?谢谢
-
我想在 firebase 中获得状态。 WORKING - 在开始功能之前和之后完成。
标签: javascript node.js firebase npm firebase-realtime-database