chore: examples: fix & simplify helloworld (#12995)

Remove the cookies code from it.
Firtly, they are not necessary: "Hello, world!" should be simple.
Secondly, it's broken on Windows: `.cookies()` hangs.

The cookies stuff was introduced recently,
in cedb24d494
(https://github.com/tauri-apps/tauri/pull/12665).
This commit reverts the changes to the example.

This supersedes https://github.com/tauri-apps/tauri/pull/12992.
This commit is contained in:
WofWca
2025-03-16 13:50:06 +04:00
committed by GitHub
parent b05f82d35b
commit 7930dde85c

View File

@@ -5,22 +5,13 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
#[tauri::command]
fn greet(app: tauri::AppHandle, name: String) -> String {
use tauri::Manager;
println!("greet {name}");
let w = app.get_webview_window("main").unwrap();
println!("{:?}", w.get_webview_window("main").unwrap().cookies());
fn greet(name: &str) -> String {
format!("Hello {name}, You have been greeted from Rust!")
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.setup(|app| {
use tauri::Manager;
println!("{:?}", app.get_webview_window("main").unwrap().cookies());
Ok(())
})
.run(tauri::generate_context!(
"../../examples/helloworld/tauri.conf.json"
))