Actually I'm New in FIRESTORE . I don't know how to enable persistence throught web. In firestore API they gave some steps, but still i didnt understand
firebase.initializeApp(config);
saveButton.addEventListener("click",function(){
var config = {
apiKey: "AIzaSyCuUm2LH0OEeojblAYHN52RFGogHEcnsDY",
authDomain: "cloud-7aac4.firebaseapp.com",
databaseURL: "https://cloud-7aac4.firebaseio.com",
projectId: "cloud-7aac4",
storageBucket: "cloud-7aac4.appspot.com",
messagingSenderId: "605897634030",
presistence:"true"};
firebase.initializeApp(config);
/*enable persistence*/
firebase.firestore().enablePersistence()
.then(function() {
var db = firebase.firestore();
var docRef = db.doc('samples/alovelace');
docRef.set({
first: 'Ada',
last: 'Lovelace',
born: 1815
});
})
.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
// ...
}
});
And also is there is any possible to enable persistence using nodejs sdk without web?
Please point me to some working samples.
Aucun commentaire:
Enregistrer un commentaire