Open evicent opened 6 years ago
@evicent It seems like later can work with an async function just fine. The following is a simple example grabbing a random Star Wars character every 5 seconds using later.setInterval
const later = require('later')
const axios = require('axios')
const s = later.parse.text('every 5 seconds')
later.setInterval(async () => {
const randomIndex = Math.ceil(Math.random() * 20)
const { data } = await axios.get(`https://swapi.co/api/people/${randomIndex}/`)
console.log(data)
}, s)
Maybe you can provide a simple example on what isn't working properly for you?
Hi!. Im trying to implement a later.setInterval function, and the function is an async call to API (Ajax). Is there any reestriccion? The thing is that the function is executed just once. I change the api function using a 'console.log' function, and worked properly...any comments?
Regards!!