1
인덱스 쿼리를 처음 사용하는 데 시간이 오래 걸립니다.indexedDb objectStore.openCursor slow 느림
사용 시나리오 : 모바일 사용 웹보기.
데이터를 indexedDb에 저장 한 후 페이지 쿼리를 처음 열면 속도가 매우 느려집니다.
쿼리 코드 :
var startTime = new Date().getTime();
var request = indexedDB.open("yfg");
request.onerror = function(event) {
\t alert("Why didn't you allow my web app to use IndexedDB?!");
};
request.onsuccess = function(event) {
\t var table = [];
\t var db = request.result;
\t var objectStore = db.transaction("table").objectStore("table");
\t //objectStore.openCursor().onsuccess = function(event) {
\t objectStore.openCursor(null,IDBCursor.NEXT).onsuccess = function(event) {
\t \t var cursor = event.target.result;
\t \t if (cursor) {
\t \t \t table.push(cursor.value);
\t \t \t cursor.continue();
\t \t }else {
\t \t \t //alert("No more entries!");
\t \t \t console.log(table);
\t \t \t var endTime = new Date().getTime();
\t \t \t console.log("总耗时:",(endTime-startTime)/1000);
\t \t }
\t };
};
콘솔에서 실행 :
얼마나 많은 데이터가 전송되고 있습니까? –
테이블 시트 1200 개 이상 bar – fan
bars? 측정 데이터의 새로운 단위입니까? 막대의 몇 바이트입니까? 신경 쓰지 말고, 질문을 올바르게 다시 읽고 IndexedDB를 사용하고 있다는 것을 깨닫게하십시오. –