$interval
instead of setInterval
JS-055734}
35
36// Run the consensus algorithm every 10 seconds
37setInterval(participateInConsensus, 10000);38
39// Start the server
40app.listen(3000, () => {
Instead of the default setInterval function, you should use the AngularJS wrapper service $interval
Rule based on Angular 1.x
// invalid
setInterval(function() {
// ...
}, 1000) // error: You should use the $interval service instead of the default window.setInterval method
// invalid
window.setInterval(function() {
// ...
}, 1000) // error: You should use the $interval service instead of the default window.setInterval method
// valid
$interval(function() {
// ...
}, 1000)