Skip to content

Commit 7e5ac02

Browse files
committed
Add code to allow terminal in BangleApps
1 parent 88a5569 commit 7e5ac02

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

js/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,7 @@ if (btn) btn.addEventListener("click", event => {
13081308
window.open(url, '_blank');
13091309
});
13101310

1311+
// Screenshot button
13111312
btn = document.getElementById("screenshot");
13121313
if (btn) btn.addEventListener("click",event=>{
13131314
getInstalledApps(false).then(()=>{
@@ -1357,3 +1358,14 @@ if (btn) btn.addEventListener("click",event=>{
13571358
}
13581359
});
13591360
});
1361+
1362+
// Open terminal button
1363+
if (Espruino.Core.Terminal)
1364+
Espruino.Core.Terminal.OVERRIDE_CONTENTS = "Click here and type to communicate with Bangle.js";
1365+
btn = document.getElementById("terminalEnable");
1366+
if (btn) btn.addEventListener("click",event=>{
1367+
document.getElementById("terminalEnable").remove();
1368+
document.querySelector(".editor__canvas").style.display = "inherit";
1369+
Comms.on("data",x=>Espruino.Core.Terminal.outputDataHandler(x))
1370+
Espruino.Core.Terminal.setInputDataHandler(function(d) { Comms.write(d); })
1371+
});

0 commit comments

Comments
 (0)