I would like an api call to be done immediately, then after 1sec, then 2sec, etc in incrementations of 1 sec up to 10.
I tried something like this:
Meteor.startup ->
counter = 1000
Meteor.setInterval (->
Meteor.call "call_url", url, (err, result) ->
...
if counter < 10000
counter += 1000
console.log counter
), counter
While my counter is incremented, the log is done exactly every seconds, which means that the setInterval doesn't keep track of the value.
The only way I see to handle this would be having 9 setTimeout to call the api at different times, then a Meteor.setInterval starting after all the timeouts... Sounds very ugly.
Any suggestions on how to do this in a clean way? It's important for the user to see frequent updates when he just connects to the page, but if he decides to let it open for a while, there is no need to perform that api query so often.