Skip to content

Commit 2875b8e

Browse files
committed
improved example
1 parent 138f491 commit 2875b8e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • examples/plain-javascript/src

examples/plain-javascript/src/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ async function greet_rust() {
99
}
1010
async function greet_python() {
1111
outputEl.textContent = await tauri.python.call.greet_python(inputField.value);
12+
// Alternatively:
13+
// outputEl.textContent = await tauri.python.callFunction("greet_python", [inputField.value])
1214
}
1315

1416
window.addEventListener("DOMContentLoaded", () => {
15-
tauri.python.registerJs("greet_python");
17+
tauri.python.registerJs("greet_python"); // Optional, makes it possible to use "tauri.python.call.greet_python"
1618
inputField = document.querySelector("#input-field");
1719
outputEl = document.querySelector("#output-element");
1820
document.querySelector("#callback-form").addEventListener("submit", (e) => {

0 commit comments

Comments
 (0)