Skip to content

Instantly share code, notes, and snippets.

@thewh1teagle
Created January 29, 2024 15:02
Show Gist options
  • Save thewh1teagle/57800b7b093f4373ecffe548d7f529b5 to your computer and use it in GitHub Desktop.
Save thewh1teagle/57800b7b093f4373ecffe548d7f529b5 to your computer and use it in GitHub Desktop.
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use std::str::FromStr;
use tauri::Manager;
use url::Url;
fn main() {
tauri::Builder::default()
.setup(|app| {
let window = tauri::WebviewWindowBuilder::new(app, "main", tauri::WebviewUrl::External(Url::from_str("https://twitter.com/").unwrap()))
.initialization_script(r#"
document.addEventListener('DOMContentLoaded', () => {
window.TAURI.core.invoke('test');
});
"#)
.build()
.expect("failed to create window");
Ok(())
})
.run(tauri::generate_context!(
"../../examples/helloworld/tauri.conf.json"
))
.expect("error while running tauri application");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment