Persistence Offline上的Node.js Firestore SDK错误

时间:2018-06-08 18:48:20

标签: firebase vue.js electron google-cloud-firestore

我在使用Electron和Vue.js启用Firebase / Firestore脱机持久性时遇到问题。

这是我的代码:firebaseInit.js

import firebase from 'firebase'
import 'firebase/firestore'
import firebaseConfig from './firebaseConfig'

firebase.initializeApp(firebaseConfig)

var db = firebase.firestore()

const settings = {timestampsInSnapshots: true}
db.settings(settings)

db.enablePersistence()
  .then(function () {
    // Initialize Cloud Firestore through firebase
    // var db = firebase.firestore()
  })
  .catch(function (err) {
    if (err.code === 'failed-precondition') {
      // Multiple tabs open, persistence can only be enabled
      // in one tab at a a time.
      // ...
    } else if (err.code === 'unimplemented') {
      // The current browser does not support all of the
      // features required to enable persistence
      // ...
    }
  })

export default db

此代码在控制台上返回错误:

enter image description here

0 个答案:

没有答案