espruino / espruino/BangleApps

widcache corrupted with comment in last line

Open
#3,939 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
571
Forks
1.3k
Avg merge
17h 38m
Merged PRs (30d)
17

Description

### Affected hardware version

Bangle 2

### Your firmware version

2v27

### The bug

When uploading a widget via Web IDE and the last line has a comment (like in the [example](https://www.espruino.com/Bangle.js+Widgets) the .widcache file gets corrupted.

```
Uncaught SyntaxError: Got EOF expected '}'
at eval (.widcache:105:95)
...orEach(k=>WIDGETS[k]=W[k]);
^
at loadWidgets (.boot0:8:91)
...Storage").read(".widcache"))
^
at eval (antonclk.app.js:3:376)
...ton;}});Bangle.loadWidgets();draw();setTimeout(Bangle.drawWi...
^
at boot code (.bootcde:9:13)
eval(_clkApp);
^
```

.widcache:
```
// Bangle.drawWidgets(); // <-- for development only}catch(e){print("hpa.wid.js",e,e.stack)}
```

Simplest solution is to add an additional line break

### Expected Behaviour
bootupdate.js should handle this

### Installed apps

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.