async function Blast2(){
const delayTime = 1000
const timer = ms => new Promise(res => setTimeout(res, ms))
function ClearDelayTime(){
return clearTimeout(blast)
}
const blast = setTimeout(function() {
let blast = "SELECT * FROM admin_contacts,temporary WHERE blast_status = 'sended'"
db.query(blast, async function (err, result, field) {
if (err) throw err;
loop:{
for (var i = 0; i < result.length; i++) {
console.log(result[i].telefone)
await timer(delayTime); // then the created Promise can be awaited
}
}
})
}, delayTime );
}
Blast2().ClearDelayTime() <------ I Want Call the fucntion ClearDelayTime() inside Blast2()
I have tried this, but without success
I would like to call a function that is inside another function, that function will clear the timeout.