feat: Make devtools a feature
Users can now enable DevTools easily, without worrying about forgetting 'uncomment' that function.
This commit is contained in:
@@ -28,3 +28,5 @@ default = [ "custom-protocol" ]
|
||||
# this feature is used used for production builds where `devPath` points to the filesystem
|
||||
# DO NOT remove this
|
||||
custom-protocol = [ "tauri/custom-protocol" ]
|
||||
# Enable DevTools for debugging.
|
||||
devtools = []
|
||||
|
||||
@@ -74,14 +74,17 @@ fn main() -> wry::Result<()> {
|
||||
}
|
||||
};
|
||||
|
||||
let _webview = WebViewBuilder::new(window)?
|
||||
let webview = WebViewBuilder::new(window)?
|
||||
.with_url(&url.to_string())?
|
||||
// .with_devtools(true)
|
||||
.with_devtools(cfg!(feature = "devtools"))
|
||||
.with_initialization_script(include_str!("pake.js"))
|
||||
.with_ipc_handler(handler)
|
||||
.build()?;
|
||||
|
||||
// _webview.open_devtools();
|
||||
#[cfg(feature = "devtools")] {
|
||||
webview.open_devtools();
|
||||
}
|
||||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = ControlFlow::Wait;
|
||||
|
||||
@@ -97,7 +100,7 @@ fn main() -> wry::Result<()> {
|
||||
..
|
||||
} => {
|
||||
if menu_id == close_item.clone().id() {
|
||||
_webview.window().set_minimized(true);
|
||||
webview.window().set_minimized(true);
|
||||
}
|
||||
println!("Clicked on {:?}", menu_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user