这部分代码在Chrome中运行良好,但在Firefox中它返回一个空数组!有什么问题吗?
const transaction = DB.transaction(['history_object_store'], 'readonly');
const store = transaction.objectStore('history_object_store');
const index = store.index('id');
const openCursor = index.openCursor(IDBKeyRange.upperBound(50));
new Promise((resolve, reject) => {
const entries = [];
openCursor.onsuccess = function(e){
const cursor = e.target.result;
if(cursor) {
entries.push(cursor.value)
} else {
resolve(entries);
}
}
});发布于 2019-05-30 02:54:06
你可能在Chrome和Firefox中加载了不同的数据。我不认为Chrome或火狐的IndexedDB实现中有任何bug会导致如此简单的情况下出现如此显着的差异。
https://stackoverflow.com/questions/56349507
复制相似问题