下面有一个代码片段
g = function() {
require(["game"], function(b) {
...
}
}
我该如何揭露 game
中的所有内容? ?我正在使用 RequireJS,这有帮助吗?
如果我这样做如果我这样做window.b= b;
并尝试访问b.functionWithin()
我收到错误 functionWithin not a function
谢谢
最佳答案
在您的示例中,从该模块导出的所有内容都分配给 b
。
关于javascript - Node.js - 公开模块内的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41393955/