Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Tauri integration #46

Open
AgarwalPragy opened this issue Jun 30, 2021 · 1 comment
Open

Question: Tauri integration #46

AgarwalPragy opened this issue Jun 30, 2021 · 1 comment

Comments

@AgarwalPragy
Copy link

Is there any non-trivial example that showcases how to share code b/w the backend and frontend when combining Dominator and Tauri?

@Pauan
Copy link
Owner

Pauan commented Jul 1, 2021

Well that depends a lot on your backend. Dominator doesn't handle state at all, it only handles displaying your state. So it's up to you how you want to manage your state.

If you're using WebSockets, then you would use the browser's WebSocket API to load the data from the server and then assign that data into Mutables.

If you're using HTTP, then you would just use standard APIs like fetch or XMLHttpRequest, just like how you would in JS.

In the case of Tauri specifically, there isn't really a "backend" or "frontend", it's all just frontend. You just import the @tauri-apps/api npm module and use it like how you would from JS. Since dominator compiles to Wasm, you can use all of the JS APIs just like how you normally would.

The Tauri team is working on creating wasm-bindgen bindings for @tauri-apps/api, so you should ask them about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants