Boiilerplate to auto-open devtools
This commit is contained in:
parent
264d9aa2fe
commit
c878c96d7c
@ -1,6 +1,8 @@
|
|||||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
|
use tauri::Manager;
|
||||||
|
|
||||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn greet(name: &str) -> String {
|
fn greet(name: &str) -> String {
|
||||||
@ -15,6 +17,15 @@ fn bash(name: &str) -> String {
|
|||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.invoke_handler(tauri::generate_handler![greet, bash])
|
.invoke_handler(tauri::generate_handler![greet, bash])
|
||||||
|
.setup(|app| {
|
||||||
|
#[cfg(debug_assertions)] // only include this code on debug builds
|
||||||
|
{
|
||||||
|
let window = app.get_window("main").unwrap();
|
||||||
|
window.open_devtools();
|
||||||
|
window.close_devtools();
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user