如何解决避免在超时以下运行代码-Node.js
我在一个函数中有一个超时并且在那个超时之下有一些代码。我需要避免在执行超时内部的函数之前运行那些代码,下面是代码。所有这些代码都在另一个函数中,请帮助。
var that = this;
setTimeout(function () {
that.endPhase();
},1000);
this.seats.forEach((seat,index) => {
if (seat !== null) {
if (this.public.activeSeat === index) {
this.seats[index].playerButtonStatus(1,1,0);
}
else {
if (this.seats[index].public.inHand){
this.seats[index].playerButtonStatus(1,-1,0);
}else {
this.seats[index].playerButtonStatus(0,0);
}
}
}
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。