javascript - 调用特定函数后执行函数(重复此操作)
问题描述
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
然后,整个过程一遍又一遍地重复。最佳解决方案是什么?
解决方案
推荐阅读
- c# - 我如何使光线投射旋转并使脚本在接触时激活
- python - 过滤器**参数中的 Q 对象
- excel - 如何在另一张表中查找值并从调整列中获取最小值和最大值
- php - 在 WooCommerce 中为特定产品类型的单个产品页面添加自定义选项卡
- r - 如何在R中对频率和百分比进行排序
- azure - 是否可以使用 Azure Devops API 访问组织范围的工件源?
- javascript - 合并和序列化 javascript 对象
- python - 单独访问字典内的列表中嵌入的嵌套内的元素
- python - 如何将数据框的值存储在单个列表中
- php - 如何使用 Google Cloud IAM 角色使用 Google OAuth 进行基于角色的 Web 应用程序控制