mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
35 lines
667 B
HTML
35 lines
667 B
HTML
<!DOCTYPE html>
|
|
<html lang="en-US">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Hello Tauri!</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div>
|
|
<h1>Hello, Tauri!</h1>
|
|
<div>
|
|
<button id="ping">ping</button>
|
|
<span id="pong"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const { invoke } = window.__TAURI__.core
|
|
|
|
const ping = document.querySelector("#ping")
|
|
const pong = document.querySelector('#pong')
|
|
|
|
ping.addEventListener("click", () => {
|
|
invoke("ping")
|
|
.then(() => {
|
|
pong.innerText = `ok: ${Date.now()}`
|
|
})
|
|
.catch(() => {
|
|
pong.innerText = `error: ${Date.now()}`
|
|
})
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|