i have a file named test2.js
created a function inside it
我有一个名为test2的文件。js在里面创建了一个函数。
var schedule = require('node-schedule');
var jobScedule = function(time, jobid) {
schedule.scheduleJob(time, function(jobid){
console.log("scheduling starts");
});
}
exports.jobScedule = jobScedule;
in test1.js
i have to call this function.
test1。我必须调用这个函数。
var objTest2 = require("./Test2.js");
var time = new Date();
var jobid=10;
objTest.jobScedule(time,jobid)
console.log(time);
console.log(jobid);
i dont know to call function from another file in node.js.rectify me
我不知道从node.js中的另一个文件调用函数。纠正我
1 个解决方案
#1
4
var objTest= require("./Test2.js");
var time = new Date();
var jobid=10;
objTest.jobScedule(time,jobid)
console.log(time);
console.log(jobid);
#1
4
var objTest= require("./Test2.js");
var time = new Date();
var jobid=10;
objTest.jobScedule(time,jobid)
console.log(time);
console.log(jobid);