preferences.js 798 B

12345678910111213141516171819202122232425262728293031323334
  1. const html = require('choo/html');
  2. import { setFileProtocolWssUrl, getFileProtocolWssUrl } from '../../app/api';
  3. export default function preferences(state, emit) {
  4. const wssURL = getFileProtocolWssUrl();
  5. function updateWssUrl(event) {
  6. state.wssURL = event.target.value;
  7. setFileProtocolWssUrl(state.wssURL);
  8. emit('render');
  9. }
  10. function clickDone(event) {
  11. event.preventDefault();
  12. emit('pushState', '/');
  13. }
  14. return html`
  15. <body>
  16. <div id="white">
  17. <div id="preferences">
  18. <a onclick="${clickDone}" href="#"> done </a>
  19. <dl>
  20. <dt>wss url:</dt>
  21. <dd>
  22. <input type="text" onchange="${updateWssUrl}" value="${wssURL}" />
  23. </dd>
  24. </dl>
  25. </div>
  26. </div>
  27. </body>
  28. `;
  29. }