Answer the question
In order to leave comments, you need to log in
How to get result from Promise?
Hello.
The following structure does not work:
async function openDb() {
return await window.indexedDB.open('test1', 1)
}
openDb().then(data => {
console.log(data.result)
}).catch(e => {
console.log(e)
})
Failed to read the 'result' property from 'IDBRequest': The request has not finished.
async function openDb() {
return await window.indexedDB.open('test1', 1)
}
openDb().then(data => {
setTimeout(function() {
console.log(data.result)
}, 1000)
}).catch(e => {
console.log(e)
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question