如何访问indexDb变量并访问该变量?

时间:2019-06-20 12:30:38

标签: javascript async-await indexeddb

需要使用async / await从IndexDb获取所有值 //期望b具有index-db的结果集

var b ="";
var request = window.indexedDB.open("mydb");
request.onsuccess = function (event) {
 var db = event.target.result;
 var objectStore = db.transaction("mytable").objectStore("mytable");
 allRecords =   objectStore.getAll();
 allRecords.onsuccess=  function(event){
   console.log(event.target.result)
    b = 10;
    b = event.target.result

 }
 console.log(b);
 //b is "" 

1 个答案:

答案 0 :(得分:0)

[[] for _ in range(4)]