Skip to content

Commit

Permalink
Add code to allow terminal in BangleApps
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Oct 21, 2024
1 parent 88a5569 commit 7e5ac02
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,7 @@ if (btn) btn.addEventListener("click", event => {
window.open(url, '_blank');
});

// Screenshot button
btn = document.getElementById("screenshot");
if (btn) btn.addEventListener("click",event=>{
getInstalledApps(false).then(()=>{
Expand Down Expand Up @@ -1357,3 +1358,14 @@ if (btn) btn.addEventListener("click",event=>{
}
});
});

// Open terminal button
if (Espruino.Core.Terminal)
Espruino.Core.Terminal.OVERRIDE_CONTENTS = "Click here and type to communicate with Bangle.js";
btn = document.getElementById("terminalEnable");
if (btn) btn.addEventListener("click",event=>{
document.getElementById("terminalEnable").remove();
document.querySelector(".editor__canvas").style.display = "inherit";
Comms.on("data",x=>Espruino.Core.Terminal.outputDataHandler(x))
Espruino.Core.Terminal.setInputDataHandler(function(d) { Comms.write(d); })
});

0 comments on commit 7e5ac02

Please sign in to comment.