无法获取ForerunnerDB以加载现有数据。在浏览器刷新时,执行新的ForeRunnerDB()命令后,整个IndexedDB数据库将从Chrome资源中消失。
var fdb = new ForerunnerDB();
// Existing database disappears from Chrome resources here
var db = fdb.db('VRC');
db.collection('videos').load();
var videoCollection = db.collection('videos');
if (!videoCollection.count()) {
videoCollection.setData([
{
"_id": 1,
"name": "Joe"
},
{
"_id": 2,
"name": "Susan"
}]);
// Yeah, I know this is redundant...
videoCollection.save();
db.save();
ForerunnerDB.save();
}发布于 2015-12-09 15:59:21
通过将函数传递给Collection.load()解决了这个问题:
videoCollection.load(function() {
// Do something with data here
});https://stackoverflow.com/questions/33898068
复制相似问题