mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-24 19:25:12 +03:00
parent
287066b279
commit
efe7811804
@ -15,10 +15,13 @@
|
||||
function runCommand(commandName, args, optional) {
|
||||
const id = optional ? '#response-optional' : '#response'
|
||||
const result = document.querySelector(id)
|
||||
window.__TAURI__
|
||||
window.__TAURI__.primitives
|
||||
.invoke(commandName, args)
|
||||
.then((response) => {
|
||||
const val = response instanceof ArrayBuffer ? new TextDecoder().decode(response) : response
|
||||
const val =
|
||||
response instanceof ArrayBuffer
|
||||
? new TextDecoder().decode(response)
|
||||
: response
|
||||
result.innerText = `Ok(${val})`
|
||||
})
|
||||
.catch((error) => {
|
||||
|
2
examples/isolation/dist/index.html
vendored
2
examples/isolation/dist/index.html
vendored
@ -71,7 +71,7 @@
|
||||
const ping = document.querySelector("#ping")
|
||||
const pong = document.querySelector('#pong')
|
||||
ping.addEventListener("click", () => {
|
||||
window.__TAURI__.tauri.invoke("ping")
|
||||
window.__TAURI__.primitives.invoke("ping")
|
||||
.then(() => {
|
||||
pong.innerText = `ok: ${Date.now()}`
|
||||
})
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
const responseContainer = document.getElementById('response')
|
||||
function runCommand(commandName, args, optional) {
|
||||
window.__TAURI__
|
||||
window.__TAURI__.primitives
|
||||
.invoke(commandName, args)
|
||||
.then((response) => {
|
||||
responseContainer.innerText += `Ok(${response})\n\n`
|
||||
|
2
examples/splashscreen/dist/index.html
vendored
2
examples/splashscreen/dist/index.html
vendored
@ -6,7 +6,7 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// we delay here just so we can see the splashscreen for a while
|
||||
setTimeout(() => {
|
||||
window.__TAURI__.invoke('close_splashscreen')
|
||||
window.__TAURI__.primitives.invoke('close_splashscreen')
|
||||
}, 2000)
|
||||
})
|
||||
</script>
|
||||
|
@ -20,7 +20,7 @@
|
||||
<source type="video/mp4" />
|
||||
</video>
|
||||
<script>
|
||||
const { invoke, convertFileSrc } = window.__TAURI__.tauri
|
||||
const { invoke, convertFileSrc } = window.__TAURI__.primitives
|
||||
const video = document.getElementById('video_source')
|
||||
const source = document.createElement('source')
|
||||
invoke('video_uri').then(([scheme, path]) => {
|
||||
|
Loading…
Reference in New Issue
Block a user