【发布时间】:2018-02-19 08:21:44
【问题描述】:
我有以下代码,当应用程序在线时可以正常工作。但是,当离线时,承诺解决或拒绝的代码不会被执行。我已经用谷歌搜索了 cloud firestore 的文档。我可以找到离线查询数据的示例,但没有在应用离线时插入数据的示例。仅包括以下相关部分。
db.collection('GroceryLists').doc().set(post).then(function () {
callback();
console.log('committed to the database');
return Promise.resolve('commited to the database');
}).catch(function (error) {
//sometimes you get this error in the offline phase
console.log('error is ', error);
return Promise.reject('error is ' + error);
});
【问题讨论】:
标签: javascript firebase google-cloud-firestore