From e449eabab2bc975402efb99c348fdd56a78920de Mon Sep 17 00:00:00 2001 From: Rintim Date: Tue, 19 Sep 2023 23:09:37 +0800 Subject: [PATCH] add async methods. --- game/game.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/game/game.js b/game/game.js index 0c0508dfc..c36cf141b 100644 --- a/game/game.js +++ b/game/game.js @@ -24749,8 +24749,12 @@ return this.hasStorage(name)?this.getStorage(name):this.setStorage(name,value); }, updateStorage:function(name,operation){ - this.setStorage(name,operation(this.getStorage(name))); - return this.getStorage(name); + return this.setStorage(name,operation(this.getStorage(name))); + }, + updateStorageAsync:function(name,operation){ + return Promise.resolve(this.getStorage(name)) + .then(value=>operation(value)) + .then(value=>this.setStorage(name,value)) }, markSkill:function(name,info,card){ if(info===true){