folgende ist mein Code -Wie exportiert man die asynchrone Funktion?
abc.js
class abc {
async foo1() {
// do something
return result;
}
async foo2() {
// do something
return result;
}
module.exports = abc
}
another-file.js
const abc = requir(./abc);
abc.foo1();
// this results in error
// TypeError : abc.foo1 is not a function
Wie soll ich das tun?
'abc' ist eine Klasse. Sie benötigen eine Instanz. Das hat nichts mit Async zu tun. – SLaks