需要给函数传一个参数,但是这种形式的interval不起作用
playGame() {
this.interval = setInterval(this.gameService.startLife(this.field),
this.timeLeft)
}
需要给函数传一个参数,但是这种形式的interval不起作用
playGame() {
this.interval = setInterval(this.gameService.startLife(this.field),
this.timeLeft)
}
对于 IE9:
对于 IE8:
通过添加回调可以更轻松地修复此代码: