openpencil/tests/helpers/tauri/invoke.ts
Danila Poyarkov 6cec1b2c58
fix: prevent repeated Keychain prompts and isolate native tests (#664)
* fix: prevent repeated Keychain prompts and isolate native tests

* fix: make credential settings contextual and actionable

* fix: refresh credential recovery state in open Settings

* fix: allow retrying credential status checks

* fix: recover credential access after backend panics

* test: centralize native Tauri invocation

* refactor: clarify credential preferences workflow path
2026-09-09 13:41:55 +03:00

17 lines
548 B
TypeScript

import type { invoke } from '@tauri-apps/api/core'
type InvokeArguments = Parameters<typeof invoke>[1]
/** Invoke inside the built WebView; package imports cannot execute in serialized callbacks. */
export async function invokeNative<T>(command: string, args?: InvokeArguments): Promise<T> {
return browser.execute(
async (command, args) => {
const core = window.__TAURI__?.core
if (!core) throw new Error('Native test requires app.withGlobalTauri')
return core.invoke<T>(command, args)
},
command,
args
)
}