Thanks, just got it.
just export each function and that's it.
// module jtools.js exports.setTimeByUrl = function(url,tz,callback) { require('http').get(url, function(res){ var date = new Date(res.headers.Date); if (date > 0 ) { setTime(date/1000); E.setTimeZone(tz); error = null; } else { error = 'no date'; } if (callback) callback(error); }); };
// test module jtools.js var jt = require('jstools'); jt.setTimeByUrl('http://www.espruino.comĀ',1,function(e){console.log(e);});
and no more erros :)
@MaBe started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks, just got it.
just export each function and that's it.
and no more erros :)