gpt4 book ai didi

javascript - 修复 Firefox 在 setInterval 上抛出错误。

转载 作者:行者123 更新时间:2023-11-30 08:54:01 24 4
gpt4 key购买 nike

<分区>

为什么 setInterval(fetchData(), 1000*60); 在 Chrome 中工作而 Firefox 抛出错误;我想将一个变量传递给 fetchdata。

   function fetchData(var) {
.....
};

fetchData(var); //run once
setInterval(fetchData(var), 1000*60); //then repeat

堆栈跟踪:

[10:26:49.764] Error: useless setInterval call (missing quotes around argument?)
userController@http://localhost:8000/mainx.js:169
invoke@http://localhost:8000/lib/angular.js:2809
instantiate@http://localhost:8000/lib/angular.js:2819
@http://localhost:8000/lib/angular.js:4639
applyDirectivesToNode/nodeLinkFn/<@http://localhost:8000/lib/angular.js:4218
forEach@http://localhost:8000/lib/angular.js:117
nodeLinkFn@http://localhost:8000/lib/angular.js:4203
compositeLinkFn@http://localhost:8000/lib/angular.js:3851
publicLinkFn@http://localhost:8000/lib/angular.js:3763
bootstrap/</<@http://localhost:8000/lib/angular.js:932
Scope.prototype.$eval@http://localhost:8000/lib/angular.js:7840
Scope.prototype.$apply@http://localhost:8000/lib/angular.js:7920
bootstrap/<@http://localhost:8000/lib/angular.js:930
invoke@http://localhost:8000/lib/angular.js:2802
bootstrap@http://localhost:8000/lib/angular.js:929
angularInit@http://localhost:8000/lib/angular.js:904
@http://localhost:8000/lib/angular.js:14527
p.Callbacks/k@http://localhost:8000/lib/jquery-1.8.2.min.js:2
p.Callbacks/l.fireWith@http://localhost:8000/lib/jquery-1.8.2.min.js:2
.ready@http://localhost:8000/lib/jquery-1.8.2.min.js:2
D@http://localhost:8000/lib/jquery-1.8.2.min.js:2

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com