mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-28 17:38:53 +02:00
feat(plugins): inject API on window.__TAURI__ (#383)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_GLOBALSHORTCUT__=function(_){"use strict";return _.isRegistered=async function(_){return await window.__TAURI_INVOKE__("plugin:globalShortcut|is_registered",{shortcut:_})},_.register=async function(_,t){return await window.__TAURI_INVOKE__("plugin:globalShortcut|register",{shortcut:_,handler:window.__TAURI__.transformCallback(t)})},_.registerAll=async function(_,t){return await window.__TAURI_INVOKE__("plugin:globalShortcut|register_all",{shortcuts:_,handler:window.__TAURI__.transformCallback(t)})},_.unregister=async function(_){return await window.__TAURI_INVOKE__("plugin:globalShortcut|unregister",{shortcut:_})},_.unregisterAll=async function(){return await window.__TAURI_INVOKE__("plugin:globalShortcut|unregister_all")},_}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_GLOBALSHORTCUT__})}
|
||||
@@ -283,6 +283,7 @@ impl Builder {
|
||||
pub fn build<R: Runtime>(self) -> TauriPlugin<R> {
|
||||
let handler = self.handler;
|
||||
PluginBuilder::new("globalShortcut")
|
||||
.js_init_script(include_str!("api-iife.js").to_string())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
register,
|
||||
register_all,
|
||||
|
||||
Reference in New Issue
Block a user