docs(migrate): JS specific event changes.

This commit is contained in:
Fabian-Lars
2025-01-28 17:56:51 +01:00
committed by GitHub
parent b701b2d7b7
commit 1d941a002c

View File

@@ -191,10 +191,12 @@ Most of the environment variables read and written by the Tauri CLI were renamed
The event system was redesigned to be easier to use. Instead of relying on the source of the event, it now has a simpler implementation that relies on event targets.
- The `emit` function now emits the event to all event listeners
- Added a new `emit_to` function to trigger an event to a specific target
- The `emit` function now emits the event to all event listeners.
- Added a new `emit_to`/`emitTo` function to trigger an event to a specific target.
- `emit_filter` now filters based on [`EventTarget`](https://docs.rs/tauri/2.0.0/tauri/event/enum.EventTarget.html) instead of a window.
- Renamed `listen_global` to `listen_any`. It now listens to all events regardless of their filters and targets.
- JavaScript: `event.listen()` behaves similar to `listen_any`. It now listens to all events regardless of their filters and targets, unless a target is set in the `Options`.
- JavaScript: `WebviewWindow.listen` etc. only listen to events emitted to the respective `EventTarget`.
### Multiwebview support