let themes = db.query(sql, [user.id], async (err, result) => {
if(err) console.error(err);
console.log(result);
await result;
});
return fetch(`/api/items/create/`)
.then(response => response.json())
.catch((err) => {
window.console.error(err);
throw err;
});
});
const func = (timerId) => {
//...
clearInterval(timerId);
}
const timerFactory = (cb, timeout) => {
let timerId = setInterval(() => {
func(timerId)
}, timeout);
return timerId;
}
let timerId = timerFactory(func, 1000);
function (val) {
return bar = val
}