mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
feat(plugins): inject API on window.__TAURI__ (#383)
This commit is contained in:
@@ -2,9 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { invoke } from "@tauri-apps/api/tauri";
|
||||
import { listen, UnlistenFn } from "@tauri-apps/api/event";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
|
||||
}
|
||||
}
|
||||
|
||||
export type LogOptions = {
|
||||
file?: string;
|
||||
line?: number;
|
||||
@@ -61,7 +66,7 @@ async function log(
|
||||
location = "webview::unknown";
|
||||
}
|
||||
|
||||
await invoke("plugin:log|log", {
|
||||
await window.__TAURI_INVOKE__("plugin:log|log", {
|
||||
level,
|
||||
message,
|
||||
location,
|
||||
|
||||
Reference in New Issue
Block a user