How do you access a function that is inside one of the scripts that you have "included" using Node's require() function?
--main-js.js--
var webnotis = require('./modules/web-notification.js')
--web-notification.js--
function getURL(host, path) {
...
}
Also how would I use this function in other required scripts?
--report-tables.js--
var cltvOut;
exports.cltv = function cltv(getURL)
{
clearTimeout(cltvOut);
cltvOut = setTimeout(function(){
if(exports.getURL('192.168.0.15', '/IMS4/Reports/calculateCLTV'))
{
cltv();
} else {
console.log('CLTV error.')
}
}, 2000);
}
webnotis2 = require('./web-notification.js')
var cltvOut;
exports.cltv = function cltv()
{
clearTimeout(cltvOut);
cltvOut = setTimeout(function(){
if(webnotis2.getUrl('192.168.0.15', '/IMS4/Reports/calculateCLTV'))
{
cltv();
} else {
console.log('CLTV error.')
}
}, 2000);
}