pub enum BrowserEffect {
ReadDomSelection,
ReadClipboard,
PersistSession {
key: String,
value: String,
},
ShowPopupToast {
message: String,
},
OpenSidePanel {
route: String,
},
InjectContentScript {
file: String,
},
}Expand description
Side effects that the Rust core requests the JavaScript runtime to execute.
The core never touches browser APIs directly. Instead, it returns a list of these effects, and the background service worker executes them in order.
§Adding a new effect
- Add a variant here
- Handle dispatch in
CoreState::dispatchto return it - Add a handler in
extension/src/background/index.jsapplyEffect()
Variants§
ReadDomSelection
Read the current DOM selection from the active tab.
ReadClipboard
Read clipboard contents via the Clipboard API.
PersistSession
Persist a key-value pair in session storage.
ShowPopupToast
Show a toast notification in the popup UI.
OpenSidePanel
Open the side panel to a specific route.
InjectContentScript
Inject a content script into the active tab.
Trait Implementations§
Source§impl Clone for BrowserEffect
impl Clone for BrowserEffect
Source§fn clone(&self) -> BrowserEffect
fn clone(&self) -> BrowserEffect
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BrowserEffect
impl Debug for BrowserEffect
Source§impl<'de> Deserialize<'de> for BrowserEffect
impl<'de> Deserialize<'de> for BrowserEffect
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BrowserEffect
impl RefUnwindSafe for BrowserEffect
impl Send for BrowserEffect
impl Sync for BrowserEffect
impl Unpin for BrowserEffect
impl UnsafeUnpin for BrowserEffect
impl UnwindSafe for BrowserEffect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more