Plain Javascript Listen #12908
-
Hi there, I am using plain JS for my frontend, with the majority of work in Rust (just using JS minimally to do the frontend basics) as I want to improve my Rust skills first and foremost. I am unsure how to get the listen working though. I am using
In Rust, I am using:
I have a struct for the payload ( My JS frontend can invoke Rust just fine but I can't get it to listen to the My other project I can invoke and |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
yes though it depends a bit on your listen call which you're not showing here. generally speaking the import { someFunction } from "@tauri-apps/api/someModule"; // somePlugin is `api` for
import { somePluginFunction } from "@tauri-apps/plugin-somePlugin/someModule";
// ^ equal to:
const { someFunction } = window.__TAURI__.someModule;
const { somePluginFunction } = window.__TAURI__.somePlugin.someModule;
Either |
Beta Was this translation helpful? Give feedback.
-
I got it working I think! I used:
@FabianLars thank you for the reply, I arrived at it as you messaged and I'm happy to see it confirmed. |
Beta Was this translation helpful? Give feedback.
yes though it depends a bit on your listen call which you're not showing here.
generally speaking the
window.__TAURI__
api is supported the same as npm. If you see docs only showing imports you can always convert them, for example: