var myDB={
name:"test",
version:3,
db:null
};
openDB(myDB.name,myDB.version);
setTimeout(function(){
closeDB(myDB.db);
deleteDB(myDB.name);
},500);
because asynchronous API is willing, there is no guarantee that the db object can be obtained before the closeDB method call (in fact, getting the db object is much slower than executing a statement)
what should I do with indexDB asynchronism here? When adding and deleting data, you always need to use setTimeout to achieve the function. Is there any other way