我正在尝试使用python-eel用gui制作一个firebasepython程序。
但是,如果firabase中的数据被更新,那么javascipt需要刷新页面以实时地从firebase获取新数据。
问题是,如果页面刷新或关闭,python eel将停止程序。
我是否可以在不刷新页面的情况下从firebase获取数据
这是代码javascript代码:
dbRefObject.on("value", function(snapshot) {
var bool = snapshot.child('command').exists();
if(bool){
var text = snapshot.child('command/text').val();
var type = snapshot.child('command/type').val();
var time = snapshot.child('command/time').val();
if(text !== 'default'){
console.log("data updated");
eel.main(text,time,type);
}
else{
console.log("no command yet");
}
}
else{
seturl('login.html');
}});
答案:python-eel不应该是实时的:<