You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a scarce support for the top-level await, I'd like to have, at the very least, the osType exposed as a constant in the JS API (and not an async function, as it is now).
Describe the solution you'd like
Add this
import { OS_TYPE } from '@tauri-apps/api/os';
and don't make me call this anymore:
import { type } from '@tauri-apps/api/os';
const osType = await type();
Alternatives considered
For other people struggling with it at the moment: use the following ugly, bad, breaking, etc hack on the client side: window.navigator.userAgent.includes("Macintosh;").
Additional context
Electron does it.
It can easily come as a non-breaking change (supplementary to the current async type, arch and such). No need to deprecate the other stuff for a long time, too.
The text was updated successfully, but these errors were encountered:
We explicitly removed all variables from the API in v2 and stopped adding them to v1, because we got many many reports about issues with ssr-first frameworks (nextjs, nuxt, sveltekit, etc) because of variables (because they need access to the navigator or window variable).
I'm not ruling it out, just warning you that this is pretty unlikely as of now. As an idea for exploration, instead of using the typical ipc, using eval/init_scripts may work (with the caveats it has).
We can't break the API in v1 so I will just consider v2 for this issue and transfer the issue to plugins-workspace.
we can't make them constants, as Fabian said, will need to access window or navigator variables and will make issues in SSR frameworks, but we can make these functions not async at least, you will also be able to directly access them using window.__TAURI_OS_PLUGIN_INTERNALS__.eol if you prefer but I wouldn't rely on these internals.
Describe the problem
Given a scarce support for the top-level await, I'd like to have, at the very least, the
osType
exposed as a constant in the JS API (and not an async function, as it is now).Describe the solution you'd like
Add this
and don't make me call this anymore:
Alternatives considered
For other people struggling with it at the moment: use the following ugly, bad, breaking, etc hack on the client side:
window.navigator.userAgent.includes("Macintosh;")
.Additional context
Electron does it.
It can easily come as a non-breaking change (supplementary to the current async
type
,arch
and such). No need to deprecate the other stuff for a long time, too.The text was updated successfully, but these errors were encountered: