fix: make isTauri runtime-unrelated (#13145)

* Update core.ts

* Update core.ts

* Update core.ts

* lint

* build

* fix lint, add change file

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
Typed SIGTERM
2025-04-13 08:30:03 +08:00
committed by GitHub
parent 7ed877a0ae
commit b8f86669ab
3 changed files with 8 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@tauri-apps/api": patch:enhance
---
`core.isTauri` now leverages `globalThis` instead of `window` in order to be used in unit tests.

File diff suppressed because one or more lines are too long

View File

@@ -325,7 +325,8 @@ export class Resource {
}
function isTauri(): boolean {
return 'isTauri' in window && !!window.isTauri
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
return !!((globalThis as any) || window).isTauri
}
export type { InvokeArgs, InvokeOptions }