You are reading a single comment by @Raik and its replies. Click here to read the full conversation.
  • During testing I often missed a function to send selected code from Editor Window to the board.
    Examples are:

    • replace code for one function only
    • add a list of testing commands to source
    • recall functions like init
      Obviously use of copy from editor and paste in terminal would help.
      For my needs it became long-winded, and a hack was born.

    Installation of quick hack:

    • start webIDE (https://www.espruino.com/ide/) in chrome browser
    • open devTools of chrome browser for this window
    • copy following source to devtools console
    • there should be a new button named P2B (post to board) at the end of editor buttons
    • select code, you want to sent
    • click the button

      a = document.createElement("a");
      a.id = "icon-paste";
      a.title = "paste to board";
      a.onclick = function(){
      var cm = Espruino.Core.EditorJavaScript.getCodeMi­rror();
      var txt = cm.getSelection();
      var tmp = Espruino.Config.RESET_BEFORE_SEND;
      Espruino.Core.MenuPortSelector.ensureCon­nected(function() {
      Espruino.Config.RESET_BEFORE_SEND = false;
      Espruino.Core.CodeWriter.writeToEspruino­(txt,function(){
        Espruino.Config.RESET_BEFORE_SEND = tmp;
      });
      });
      };
      a.innerText = "P2B";
      x = document.getElementById("icon-deploy");
      x.parentNode.insertBefore(a,x.nextSiblin­gElement);
      
  • That's awesome. I find myself often enough doing the same thing.

    +1 for making this a standard feature of the WebIDE :)

About

Avatar for Raik @Raik started