我正在开发有两种登录方式的app .

意味着我需要离线登录和在线登录 .

对于在线,我将使用Web服务 . 但是对于离线我想保持 Javascript Firebase Realtime Database .

我已将所需的js文件下载到我的资源中 .

我还初始化了Firebase .

I want to sync the database with my app with some events. But how to sync that is not clear for me.

<script src="js/firebase.js"></script>
<script src="js/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.5.2/firebase-auth.js"></script>
<script src="js/firebase-database.js"></script>

<script>
  // Initialize Firebase
  var config = {
    apiKey: "*****",
    authDomain: "*******",
    databaseURL: "******",
    storageBucket: "********",
    messagingSenderId: "******"
  };
  firebase.initializeApp(config);

  // Get a reference to the database service
  var database = firebase.database();

</script>

如果您想了解更多信息,请与我们联系 .

How can I sync database with my app ?

How can I initialize my database connection in offline mode and how can I read and write data to firebase realtime database in offline mode ?

任何帮助将不胜感激 .