You are reading a single comment by @MaBe and its replies. Click here to read the full conversation.
  • 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 :)

About

Avatar for MaBe @MaBe started