From 1e42b63d500f1aeaaf879c23afe5bdf72e6c36d7 Mon Sep 17 00:00:00 2001 From: Olivier Lemasle Date: Sat, 21 Oct 2023 20:36:25 +0200 Subject: [PATCH] fix(examples): use __TAURI__.primitives Closes #8073 --- examples/commands/index.html | 7 +++++-- examples/isolation/dist/index.html | 2 +- examples/parent-window/index.html | 2 +- examples/splashscreen/dist/index.html | 2 +- examples/streaming/index.html | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/commands/index.html b/examples/commands/index.html index 3abb8cb8a7e7..66841fd70c2c 100644 --- a/examples/commands/index.html +++ b/examples/commands/index.html @@ -15,10 +15,13 @@

Tauri Commands

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) => { diff --git a/examples/isolation/dist/index.html b/examples/isolation/dist/index.html index 7ecca7406639..7af93b540e07 100644 --- a/examples/isolation/dist/index.html +++ b/examples/isolation/dist/index.html @@ -71,7 +71,7 @@

Hello, Tauri!

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()}` }) diff --git a/examples/parent-window/index.html b/examples/parent-window/index.html index 776293db78f8..059607659d71 100644 --- a/examples/parent-window/index.html +++ b/examples/parent-window/index.html @@ -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` diff --git a/examples/splashscreen/dist/index.html b/examples/splashscreen/dist/index.html index 7e96301cf59e..a51c58d6088d 100644 --- a/examples/splashscreen/dist/index.html +++ b/examples/splashscreen/dist/index.html @@ -6,7 +6,7 @@

This is the main window!

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) }) diff --git a/examples/streaming/index.html b/examples/streaming/index.html index edcc5f020d0a..a0eabf610ab7 100644 --- a/examples/streaming/index.html +++ b/examples/streaming/index.html @@ -20,7 +20,7 @@