首页 > 解决方案 > 调用特定函数后执行函数(重复此操作)

问题描述

game.start(param1, param2, (e) => {

     axios.post(e).then(() => {
         console.log("axios callback got executed"):
     })


}, (b) => {
   console.log("execute this after axios callback gets executed")
}

(e)game.start多次执行的回调。比如说10次。

(b)回调的game.start执行次数要少得多。比方说3次。

现在,每当需要执行回调时,当代码进入那里时,如果还没有完成(b),我不希望我console.log被执行。axios call然后,整个过程一遍又一遍地重复。最佳解决方案是什么?

标签: javascriptpromisedom-events

解决方案


推荐阅读