index.js 564 B

123456789101112131415161718
  1. const WebviewWindow = window.__TAURI__.window.WebviewWindow
  2. const routeSelect = document.querySelector('#route')
  3. const link = document.querySelector('#link')
  4. routeSelect.addEventListener('change', (event) => {
  5. link.href = event.target.value
  6. })
  7. document.querySelector('#go').addEventListener('click', () => {
  8. window.location.href = window.location.origin + '/' + routeSelect.value
  9. })
  10. document.querySelector('#open-window').addEventListener('click', () => {
  11. new WebviewWindow(Math.random().toString().replace('.', ''), {
  12. url: routeSelect.value
  13. })
  14. })