簡體   English   中英

使用 Python 時從 firebase 更新數據而不刷新

[英]Update data from firebase without refreshing when using Python Eel

我正在嘗試使用 python 鰻魚制作帶有 gui 的 firebase python 程序。

但是如果 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 鰻魚不應該是實時的:<

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM