Skip to main content

BrowserEvent

Enum BrowserEvent 

Source
#[non_exhaustive]
pub enum BrowserEvent {
Show 20 variants WindowOpened { window_id: WindowId, title: String, }, WindowClosed { window_id: WindowId, }, TabActivated { window_id: WindowId, tab_id: TabId, previous_tab_id: Option<TabId>, }, TabOpened { tab_id: TabId, window_id: WindowId, index: u32, url: String, title: String, }, TabClosed { tab_id: TabId, window_id: WindowId, is_window_closing: bool, }, TabNavigated { tab_id: TabId, window_id: WindowId, url: String, }, TabTitleChanged { tab_id: TabId, window_id: WindowId, title: String, }, TabStatusChanged { tab_id: TabId, window_id: WindowId, status: TabStatus, }, DownloadCreated { download_id: DownloadId, url: String, filename: String, mime: Option<String>, }, DownloadChanged { download_id: DownloadId, state: Option<DownloadState>, filename: Option<String>, error: Option<String>, }, DownloadErased { download_id: DownloadId, }, TabMoved { tab_id: TabId, window_id: WindowId, from_index: u32, to_index: u32, }, TabAttached { tab_id: TabId, new_window_id: WindowId, new_index: u32, }, TabDetached { tab_id: TabId, old_window_id: WindowId, old_index: u32, }, WindowFocusChanged { window_id: Option<WindowId>, }, TabGroupCreated { group_id: TabGroupId, window_id: WindowId, title: String, color: String, collapsed: bool, }, TabGroupUpdated { group_id: TabGroupId, window_id: WindowId, title: String, color: String, collapsed: bool, }, TabGroupRemoved { group_id: TabGroupId, window_id: WindowId, }, ExtensionError { kind: String, message: String, detail: String, }, EventsLost { count: u64, },
}
Expand description

An event emitted by the browser extension and broadcast to all event-stream subscribers.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

WindowOpened

A new browser window was opened.

Fields

§window_id: WindowId

The new window’s ID.

§title: String

The window’s title at the time it was created (may be empty).

§

WindowClosed

A browser window was closed.

Fields

§window_id: WindowId

The ID of the closed window.

§

TabActivated

The active tab in a window changed.

Fields

§window_id: WindowId

The window containing the newly active tab.

§tab_id: TabId

The ID of the newly active tab.

§previous_tab_id: Option<TabId>

The ID of the previously active tab, if any.

§

TabOpened

A new tab was opened.

Fields

§tab_id: TabId

The new tab’s ID.

§window_id: WindowId

The window containing the new tab.

§index: u32

Zero-based position of the tab within its window.

§url: String

The URL loaded in the tab at creation time (may be empty or "about:blank").

§title: String

The tab’s title at creation time (often empty).

§

TabClosed

A tab was closed.

Fields

§tab_id: TabId

The ID of the closed tab.

§window_id: WindowId

The window that contained the tab.

§is_window_closing: bool

Whether the tab was closed because its parent window was also closing.

§

TabNavigated

A tab started loading a new URL.

Fields

§tab_id: TabId

The ID of the navigating tab.

§window_id: WindowId

The window containing the tab.

§url: String

The new URL.

§

TabTitleChanged

A tab’s title changed.

Fields

§tab_id: TabId

The ID of the tab.

§window_id: WindowId

The window containing the tab.

§title: String

The new title.

§

TabStatusChanged

A tab’s loading status changed (e.g. from loading to complete).

Fields

§tab_id: TabId

The ID of the tab.

§window_id: WindowId

The window containing the tab.

§status: TabStatus

The new loading status.

§

DownloadCreated

A new download was started.

Fields

§download_id: DownloadId

The download’s ID.

§url: String

The URL being downloaded.

§filename: String

The filename (may be empty until determined).

§mime: Option<String>

The MIME type, if known.

§

DownloadChanged

A download’s state or properties changed.

Fields

§download_id: DownloadId

The download’s ID.

§state: Option<DownloadState>

The new state, if it changed.

§filename: Option<String>

The new filename, if it changed.

§error: Option<String>

The error reason, if the download was interrupted.

§

DownloadErased

A download was removed from the browser’s history.

Fields

§download_id: DownloadId

The download’s ID.

§

TabMoved

A tab was moved to a new position within its window.

Fields

§tab_id: TabId

The ID of the moved tab.

§window_id: WindowId

The window containing the tab.

§from_index: u32

The previous zero-based index.

§to_index: u32

The new zero-based index.

§

TabAttached

A tab was attached to a window (moved from another window).

Fields

§tab_id: TabId

The ID of the attached tab.

§new_window_id: WindowId

The window the tab was attached to.

§new_index: u32

The tab’s new zero-based index in the window.

§

TabDetached

A tab was detached from a window (being moved to another window).

Fields

§tab_id: TabId

The ID of the detached tab.

§old_window_id: WindowId

The window the tab was detached from.

§old_index: u32

The tab’s old zero-based index in the window.

§

WindowFocusChanged

The focused window changed.

Fields

§window_id: Option<WindowId>

The newly focused window ID, or None if all windows lost focus (e.g. the user switched to another application).

§

TabGroupCreated

A tab group was created. Chrome-only.

Fields

§group_id: TabGroupId

The new group’s ID.

§window_id: WindowId

The window containing the group.

§title: String

The group’s display title.

§color: String

The group’s color.

§collapsed: bool

Whether the group is collapsed.

§

TabGroupUpdated

A tab group’s properties changed. Chrome-only.

Fields

§group_id: TabGroupId

The updated group’s ID.

§window_id: WindowId

The window containing the group.

§title: String

The group’s display title.

§color: String

The group’s color.

§collapsed: bool

Whether the group is collapsed.

§

TabGroupRemoved

A tab group was removed. Chrome-only.

Fields

§group_id: TabGroupId

The removed group’s ID.

§window_id: WindowId

The window that contained the group.

§

ExtensionError

An uncaught error or unhandled promise rejection occurred in the extension’s service worker.

These are forwarded from the extension’s global error handlers so they are visible in the mediator log and event stream.

Fields

§kind: String

Error category (e.g. "uncaught_error", "unhandled_rejection").

§message: String

Human-readable error message.

§detail: String

Stack trace or additional context.

§

EventsLost

Some events were lost because the consumer could not keep up.

This is a synthetic event generated by the mediator, not the browser. The consumer should assume that any cached state may be stale and re-query if needed.

Fields

§count: u64

The number of events that were dropped.

Implementations§

Source§

impl BrowserEvent

Source

pub const fn is_download_event(&self) -> bool

Returns true if this is a download-related event.

Source

pub const fn matches_filter( &self, include_windows_tabs: bool, include_downloads: bool, ) -> bool

Returns true if this event passes the given subscription filter.

When both include_windows_tabs and include_downloads are false, all events pass (backward compatible “no filter” mode).

Trait Implementations§

Source§

impl Clone for BrowserEvent

Source§

fn clone(&self) -> BrowserEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BrowserEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BrowserEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for BrowserEvent

Source§

fn eq(&self, other: &BrowserEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for BrowserEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for BrowserEvent

Source§

impl StructuralPartialEq for BrowserEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,