HUZZAH!!!!! Thank you!!
htypes=["Temp","RH","Pressure","AirQual","Clear","Red","Green","Blue"]; function writeTypedHistory(res,tdx) { var typen = htypes[tdx]; res.write((tdx === 0) ? '{"' : ',"'); res.write(typen); res.write('":'); res.write(JSON.stringify(HISTORY[typen])); if (++tdx < htypes.length) { setTimeout(writeTypedHistory,200,res,tdx); } else { res.write('}'); res.end(); } } function processrequest(req, res) { try { var par=url.parse(req.url,true); var q=par.query; var path=par.pathname; path=path.split('/'); path=path[1]; switch(path) { case "history.json": res.writeHead(200,head); setTimeout(writeTypedHistory,10,res,0); break; <snip> } } catch (err){ res.writeHead(500,head); res.write("{status:\"error\",error:\""+err.message+"\"}"); res.end(); } }
@DrAzzy 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.
HUZZAH!!!!! Thank you!!