tauri/.changes/tauri-event-after-multiwebview.md
Amr Bashir a093682d2d
refactor(core): refactor and fix event system following multiwebview support (#8621)
* clippy

* refactor(core): refactor and fix event system following multiwebview support

* update documentation

* update js docs

* lint

* clippy

* update multiwindow example [skip ci]

* enhance event tests

* fix example

* Update .changes/tauri-event-after-multiwebview.md

Co-authored-by: Lucas Nogueira <118899497+lucasfernog-crabnebula@users.noreply.github.com>

* fix tests

* add diagram

* Add `App/AppHandle` even target

* Discard changes to examples/api/src-tauri/tauri-plugin-sample/permissions/schemas/schema.json

* revert accidental changes

* regenerate schemas

* fix doctests

* add helper methods

* update docs

* update api

* update docs [skip ci]

* update docs [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <118899497+lucasfernog-crabnebula@users.noreply.github.com>
2024-02-01 08:06:27 -03:00

880 B

tauri
patch:breaking

Refactored the event system to better accommodate the new window types:

  • Added EventTarget enum.
  • Added App/AppHandle::listen, App/AppHandle::once and App/AppHandle::unlisten to listen to events targeting App/AppHandle
  • App/AppHandle/Window/Webview/WebviewWindow::emit will now emit to all event listeners.
  • App/AppHandle/Window/Webview/WebviewWindow::emit_to will emit to event targets that match the given label, see EventTarget enum.
  • App/AppHandle/Window/Webview/WebviewWindow::emit_filter will emit to event targets based on a filter callback which now takes &EventTarget instead of &Window.
  • Renamed Manager::listen_global and Manager::once_global to listen_any and once_any respectively to be consistent with EventTarget::Any, it will now also listen to any event to any target (aka event sniffer).