|
%!s(int64=2) %!d(string=hai) anos | |
---|---|---|
.. | ||
core | %!s(int64=2) %!d(string=hai) anos | |
src | %!s(int64=2) %!d(string=hai) anos | |
static | %!s(int64=2) %!d(string=hai) anos | |
.gitignore | %!s(int64=2) %!d(string=hai) anos | |
.npmrc | %!s(int64=2) %!d(string=hai) anos | |
README.md | %!s(int64=2) %!d(string=hai) anos | |
package.json | %!s(int64=2) %!d(string=hai) anos | |
svelte.config.js | %!s(int64=2) %!d(string=hai) anos | |
tsconfig.json | %!s(int64=2) %!d(string=hai) anos | |
vite.config.ts | %!s(int64=2) %!d(string=hai) anos | |
yarn.lock | %!s(int64=2) %!d(string=hai) anos |
This example showcases an application that has shares code between a desktop and a Web target.
The Web application uses WASM to communicate with the Rust backend, while the desktop app leverages Tauri commands.
The Rust code lives in the core/
folder and it is a Cargo workspace with three crates:
The Rust code bridge is defined in the src/api/
folder, which defines desktop/index.js
and a web/index.js
interfaces.
To access the proper interface according to the build target, a resolve alias is defined in vite.config.js, so the API can be imported
with import * as api from '$api'
.
Use the following commands to run the desktop application:
yarn
yarn tauri dev
Use the following commands to run the Web application:
yarn
yarn dev:web