I have an array of objects, I need to pass them one by one to a function, but I want to give a 1sec pause between each item in the array:
async function ChamandoEtiquetas() {
if(id) {
if(NumerosEtiquetas) {
NumerosEtiquetas.forEach(async (Etiqueta) => {
await MontagemFiltro(Etiqueta)
})
}
}
}
async function MontagemFiltro(Etiqueta) {
var CodigoDeBarras = "teste";
await setFiltro(CodigoDeBarras)
}
I need to do this, because there are 2 functions that are called when changing the "setFiltro", and it takes a few milliseconds. Because of that the function is only doing what it has to do with the last index of the array