mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-24 21:40:48 +02:00
feat(plugins): inject API on window.__TAURI__ (#383)
This commit is contained in:
@@ -3,7 +3,11 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { invoke } from "@tauri-apps/api/tauri";
|
||||
declare global {
|
||||
interface Window {
|
||||
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Well known window positions.
|
||||
@@ -33,7 +37,7 @@ export enum Position {
|
||||
* @param to The {@link Position} to move to.
|
||||
*/
|
||||
export async function moveWindow(to: Position): Promise<void> {
|
||||
await invoke("plugin:positioner|move_window", {
|
||||
await window.__TAURI_INVOKE__("plugin:positioner|move_window", {
|
||||
position: to,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user