index.html 618 B

123456789101112131415161718192021
  1. <html>
  2. <head>
  3. <meta charset="UTF-8">
  4. <title>Hello World!</title>
  5. </head>
  6. <body>
  7. <h1>Hello World!</h1>
  8. <script>
  9. var getAvailablePorts = require("./spike/available_serial_ports");
  10. getAvailablePorts().then((ports) => {
  11. var select = document.createElement("select");
  12. ports.forEach(p => {
  13. var option = document.createElement("option");
  14. option.innerText = p;
  15. select.appendChild(option);
  16. });
  17. document.body.appendChild(select);
  18. }).catch(e=>{alert(e)});
  19. </script>
  20. </body>
  21. </html>