【发布时间】:2018-01-25 23:30:01
【问题描述】:
以下是我的代码 -
abc.js
class abc {
async foo1() {
// do something
return result;
}
async foo2() {
// do something
return result;
}
module.exports = abc
}
另一个文件.js
const abc = requir(./abc);
abc.foo1();
// this results in error
// TypeError : abc.foo1 is not a function
我应该怎么做?
【问题讨论】:
-
abc是一个类。你需要一个实例。这与异步无关。
标签: node.js asynchronous module export