feat(plugins): inject API on window.__TAURI__ (#383)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-23 10:20:14 -07:00
committed by GitHub
parent 3c8577bc9a
commit b131bc8f7c
78 changed files with 754 additions and 337 deletions
+3 -1
View File
@@ -212,13 +212,15 @@ impl<R: Runtime, T: Manager<R>> crate::NotificationExt<R> for T {
/// Initializes the plugin.
pub fn init<R: Runtime>() -> TauriPlugin<R> {
let mut init_script = include_str!("init.js").to_string();
init_script.push_str(include_str!("api-iife.js"));
Builder::new("notification")
.invoke_handler(tauri::generate_handler![
commands::notify,
commands::request_permission,
commands::is_permission_granted
])
.js_init_script(include_str!("init.js").into())
.js_init_script(init_script)
.setup(|app, api| {
#[cfg(mobile)]
let notification = mobile::init(app, api)?;