Files
tauri/examples/navigation/public/index.js
2023-02-19 10:17:49 -03:00

23 lines
706 B
JavaScript

// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
const WebviewWindow = window.__TAURI__.window.WebviewWindow
const routeSelect = document.querySelector('#route')
const link = document.querySelector('#link')
routeSelect.addEventListener('change', (event) => {
link.href = event.target.value
})
document.querySelector('#go').addEventListener('click', () => {
window.location.href = window.location.origin + '/' + routeSelect.value
})
document.querySelector('#open-window').addEventListener('click', () => {
new WebviewWindow(Math.random().toString().replace('.', ''), {
url: routeSelect.value
})
})