pub struct Builder { /* private fields */ }
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn with_flags(self, flags: Flags) -> Self
pub fn with_flags(self, flags: Flags) -> Self
Set flags to control which shortcuts the plugin should disable.
§Examples
use tauri_plugin_prevent_default::Flags;
tauri_plugin_prevent_default::Builder::new()
.with_flags(Flags::CONTEXT_MENU | Flags::PRINT | Flags::DOWNLOADS)
.build();
Sourcepub fn shortcut<S>(self, shortcut: S) -> Selfwhere
S: Shortcut + 'static,
pub fn shortcut<S>(self, shortcut: S) -> Selfwhere
S: Shortcut + 'static,
Disable a custom shortcut.
§Examples
use tauri_plugin_prevent_default::KeyboardShortcut;
use tauri_plugin_prevent_default::ModifierKey::{CtrlKey, ShiftKey};
tauri_plugin_prevent_default::Builder::new()
.shortcut(KeyboardShortcut::new("F12"))
.shortcut(KeyboardShortcut::with_modifiers("E", &[CtrlKey, ShiftKey]))
.shortcut(KeyboardShortcut::with_shift_alt("I"))
.build();
Sourcepub fn check_origin(self, origin: impl AsRef<str>) -> Self
pub fn check_origin(self, origin: impl AsRef<str>) -> Self
Check location origin before disabling the shortcuts.
Sourcepub fn build<R: Runtime>(self) -> TauriPlugin<R>
pub fn build<R: Runtime>(self) -> TauriPlugin<R>
Build the plugin.
Sourcepub fn build_with_manual_injection<R: Runtime>(self) -> TauriPlugin<R>
pub fn build_with_manual_injection<R: Runtime>(self) -> TauriPlugin<R>
Build the plugin, but do not inject the script into the webviews. The script should then be manually set as the initialization script when creating the window.
§Examples
use tauri::{AppHandle, WebviewUrl, WebviewWindowBuilder};
use tauri_plugin_prevent_default::PreventDefault;
fn create_window(app: &AppHandle) {
let url = WebviewUrl::App("index.html".into());
WebviewWindowBuilder::new(app, "main", url)
.initialization_script(app.script())
.build()
.unwrap();
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl !RefUnwindSafe for Builder
impl !Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more