Skip to content

How can I use 'app' in #[tauri::command] #5081

Answered by abisar
zhibisora asked this question in Q&A
Discussion options

You must be logged in to vote

I missed it too when I first started with tauri. It's here:
https://tauri.app/v1/guides/features/command/#accessing-an-apphandle-in-commands

#[tauri::command]
fn open_devtools(app_handle: AppHandle) {
    app_handle.get_window("main").unwrap().open_devtools();
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zhibisora
Comment options

Answer selected by zhibisora
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants