我正在尝试module.exports()
在我的 NW.js 应用程序中创建一个新模块。
我有两个正在使用的文件:
索引.js
const gkm = require('gkm'); //This is a key listener
const AudioStreamMeter = require('audio-stream-meter'); //This is a mic listener
const exportable = require("./twitchAuth.js");
exportable.test();
// More code under this
twitchAuth.js
function doSomething() {
document.getElementById("volume").style.backgroundColor = "#FFF";
}
module.exports(doSomething);
唯一的问题是,当我添加const exportable = require("./separateFile.js");
到index.js
thengkm
并audio-stream-meter
停止工作以及我的其他代码时。