javascript make callback asynchronous code example
Example 1: tesseract Calling an asynchronous function without callback is deprecated.
In node-tesseract's folder modify tesseract.js:
Before:
fs.unlink(files[0]);
Now:
fs.unlink(files[0], err => { if (err) console.log(err) });
Example 2: await callback
function apiOn(event) {
return new Promise(resolve => {
api.on(event, response => resolve(response));
});
}