Yep, I meant to come back here and clarify that as well.
Exactly as Gordon suggested, I had to add square brackets [...] around the require("Storage").readJSON("shadowclk.json", true) in the Puck.eval() call to wrap the resulting data in an array. Then extract the actual data from the array using let data = dataArray ? dataArray[0] : null;. like this:"
Puck.eval('[require("Storage").readJSON("shadowclk.json", true)]', (dataArray) => {
let data = dataArray ? dataArray[0] : null;
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.
Yep, I meant to come back here and clarify that as well.
Exactly as Gordon suggested, I had to add square brackets [...] around the
require("Storage").readJSON("shadowclk.json", true)
in thePuck.eval()
call to wrap the resulting data in an array. Then extract the actual data from the array usinglet data = dataArray ? dataArray[0] : null;.
like this:"