Voici mon code -Comment exporter une fonction asynchrone?
abc.js
class abc {
async foo1() {
// do something
return result;
}
async foo2() {
// do something
return result;
}
module.exports = abc
}
autre-file.js
const abc = requir(./abc);
abc.foo1();
// this results in error
// TypeError : abc.foo1 is not a function
Comment dois-je faire?
'abc' est une classe. Vous avez besoin d'une instance. Cela n'a rien à voir avec async. – SLaks