In my app.js I exported the function:
var video_sets = [];
...// get the video_sets
console.log(video_sets);
module.exports = {
requestVideo: function () {
return video_sets;
}
};
I tried using console.log(video_sets)
to make sure it's not an empty array. When I call this function in another module I get an empty object.
var app = require('./app');
console.log(app.requestVideo());
You can only do :
module.exports.video_sets = video_sets;
No need for extra lines.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.