Optimize game.getDB.
(cherry picked from commit 9f72aebbbd86dff2fe99f683dedb592e1c78b810)
This commit is contained in:
parent
c16a92a24f
commit
97db71b24b
16
game/game.js
16
game/game.js
|
@ -38169,31 +38169,29 @@
|
|||
return;
|
||||
}
|
||||
lib.status.reload++;
|
||||
var store=lib.db.transaction([type],'readwrite').objectStore(type);
|
||||
const store=lib.db.transaction([type],'readwrite').objectStore(type);
|
||||
if(id){
|
||||
store.get(id).onsuccess=function(e){
|
||||
store.get(id).onsuccess=e=>{
|
||||
_status.dburgent=true;
|
||||
callback(e.target.result);
|
||||
delete _status.dburgent;
|
||||
game.reload2();
|
||||
};
|
||||
return;
|
||||
}
|
||||
else{
|
||||
var obj={};
|
||||
store.openCursor().onsuccess=function(e){
|
||||
var cursor=e.target.result;
|
||||
const obj={};
|
||||
store.openCursor().onsuccess=e=>{
|
||||
const cursor=e.target.result;
|
||||
if(cursor){
|
||||
obj[cursor.key]=cursor.value;
|
||||
cursor.continue();
|
||||
return;
|
||||
}
|
||||
else{
|
||||
_status.dburgent=true;
|
||||
callback(obj);
|
||||
delete _status.dburgent;
|
||||
game.reload2();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
deleteDB:function(type,id,callback){
|
||||
if(!lib.db){
|
||||
|
|
Loading…
Reference in New Issue