Help, How to invoke from rust. #8601
-
I need to invoke JS from rust and have a listener in JS. I have the listener done, but how about the invoker? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm not sure what you mean with a listener in this context. So if my generic answer doesn't help, please provide examples for what you mean/what you tried. In general though, there's no JS equivalent to tauri's invoke/command system (to call rust commands from js). |
Beta Was this translation helpful? Give feedback.
I'm not sure what you mean with a listener in this context. So if my generic answer doesn't help, please provide examples for what you mean/what you tried.
In general though, there's no JS equivalent to tauri's invoke/command system (to call rust commands from js).
Instead you either have to use an emit/listen combination (events), or use
window.eval()
if your js side is in global scope (for example on the js window var), example:window.eval("window.myFunction('something')")
(to be clear, the first window is in rust, the second one in js)