This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
在您的
setInterval
中,您正在执行函数并将其返回值作为参数传递,而不是将函数本身传递为参数。应该是:
请注意,您不会在功能内使用
此
,因为它将在setInterval
范围内进行调用。如果您需要使用
此
,请使用bind()
:In your
setInterval
you are executing the function and passing it's return value as argument, instead of passing function itself as argument.It should be:
Note, you won't be use
this
inside the function, because it will be called insidesetInterval
scope.If you need to use
this
, then usebind()
:您似乎在两个地方称为“ scrape()”方法。一旦进入setInterval()方法,然后立即在线路上再次在线上。看起来像你的问题。
You seem to be calling the "scrape()" method in two places. Once in the SetInterval() method and then immediately again on the line after. That looks like your problem.