Describe the bug
The event module is private, making it impossible to reference Event or EventHandler.
To Reproduce
- Try to import
tauri::event::{Event, EventHandler}
Expected behavior
The module is not private.
Platform and Versions (required):
Operating System - Windows, version 10.0.19042 X64
Webview2 - 94.0.992.38
Node.js environment
Node.js - 16.11.0
@tauri-apps/cli - 1.0.0-beta.10
@tauri-apps/api - 1.0.0-beta.8
Global packages
npm - 8.0.0
yarn - 1.22.15
Rust environment
rustc - 1.57.0-nightly
cargo - 1.57.0-nightly
App directory structure
/.git
/.idea
/node_modules
/public
/src
/src-tauri
App
tauri.rs - 1.0.0-beta.8
build-type - bundle
CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
distDir - Set automatically by Vue CLI plugin
devPath - Set automatically by Vue CLI plugin
framework - Vue.js (Vue CLI)
bundler - Webpack
Additional context
I would like to do this:
fn some_func(&self) {
self.handle.listen_global("send-packet", listener);
}
fn listener(event: Event) {
// ...
}
Unfortunately, there is no way for me to use the necessary type, so this is impossible.
In addition, it is impossible to store the result of listen_global to be unlistened later, since there's no way to reference EventHandler in a struct.
I wonder if it's a Rust bug that the API is even allowed to do this. It's essentially exposing a private type in the public API, which you can't do normally.
Describe the bug
The event module is private, making it impossible to reference
EventorEventHandler.To Reproduce
tauri::event::{Event, EventHandler}Expected behavior
The module is not private.
Platform and Versions (required):
Additional context
I would like to do this:
Unfortunately, there is no way for me to
usethe necessary type, so this is impossible.In addition, it is impossible to store the result of
listen_globalto beunlistened later, since there's no way to referenceEventHandlerin a struct.I wonder if it's a Rust bug that the API is even allowed to do this. It's essentially exposing a private type in the public API, which you can't do normally.