Skip to content

How to Callback from rust #11302

Answered by FabianLars
charlesooo asked this question in Q&A
Oct 10, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You could listen() to another event before your win.emit line and then after the win.emit line block the function to wait for the response via a channel or whatever. It could look something like this, note that i wrote this here so it may not compile but it should give you an idea

use actix_web::web;
use actix_web::{App, HttpResponse, HttpServer};
use std::sync::OnceLock;
use tauri::Emitter;
use tauri::{Manager, WebviewWindow};

static WINDOW: OnceLock<WebviewWindow> = OnceLock::new();
static CORS_HEADER: (&str, &str) = ("Access-Control-Allow-Origin", "*");

async fn handler(bytes: web::Bytes) -> HttpResponse {
    let win = WINDOW.get().unwrap();

	let (sender, receiver) = std::sync::mpsc::

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@charlesooo
Comment options

Answer selected by charlesooo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants