tauri/examples/web
Amr Bashir e1e85dc2a5
chore: fix ci and cleanup leftovers (#6925)
* chore: fix ci and cleanup leftovers

1. removed leftover feature flags
2. remove zip/extract apis which are not used anymore
3. removed leftoever scopes
4. removed leftover allowlist and updater options
5. updated the example api

* remove leftover updater structs

* move updater under bundle and remove uneeded options

* fix cli on linux

* remove create_proxy

* clippy

* more clippy

* clippppy

* readd path api

* fix api example

* remove window allowlist

* remove window from allowlist config

* remove `all` allowlist option

* remove file_move

* lint

* fix windows build

* remvoe unused deps

* remvoe allowlist config option, move protocol to `security > asset_protocol`

* fix diffing features

* fmt and test

* fix scope alias

* change files

* android lint

* simplify allow_file impl

* Revert "simplify allow_file impl"

This reverts commit b8882f2fd0.

* expose scopes

* remove unused error variants

* protocol-asset on docs.rs

* ignore reqwest on udeps

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-05-13 13:48:28 +03:00
..
core chore: fix ci and cleanup leftovers (#6925) 2023-05-13 13:48:28 +03:00
src chore: update license year (#6311) 2023-02-19 10:17:49 -03:00
static feat(examples): add desktop/web application example (#5537) 2022-11-03 18:01:47 -03:00
.gitignore feat(examples): add desktop/web application example (#5537) 2022-11-03 18:01:47 -03:00
.npmrc feat(examples): add desktop/web application example (#5537) 2022-11-03 18:01:47 -03:00
package.json feat(examples): add desktop/web application example (#5537) 2022-11-03 18:01:47 -03:00
README.md feat(examples): add desktop/web application example (#5537) 2022-11-03 18:01:47 -03:00
svelte.config.js chore: update license year (#6311) 2023-02-19 10:17:49 -03:00
tsconfig.json feat(examples): add desktop/web application example (#5537) 2022-11-03 18:01:47 -03:00
vite.config.ts chore: update license year (#6311) 2023-02-19 10:17:49 -03:00
yarn.lock feat(examples): add desktop/web application example (#5537) 2022-11-03 18:01:47 -03:00

Desktop / Web Example

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.

Architecture

The Rust code lives in the core/ folder and it is a Cargo workspace with three crates:

  • tauri: desktop application. Contains the commands that are used by the frontend to access the Rust APIs;
  • wasm: library that is compiled to WASM to be used by the Web application;
  • api: code shared between the Tauri and the WASM crates. Most of the logic should live here, with only the specifics in the tauri and wasm 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'.

Running the desktop application

Use the following commands to run the desktop application:

yarn
yarn tauri dev

Running the Web application

Use the following commands to run the Web application:

yarn
yarn dev:web