pub(crate) struct BrowserContext {
channel: ChannelOwner,
var: Mutex<Variable>,
tx: Mutex<Option<Sender<Evt>>>,
}Fields§
§channel: ChannelOwner§var: Mutex<Variable>§tx: Mutex<Option<Sender<Evt>>>Implementations§
Source§impl BrowserContext
impl BrowserContext
const DEFAULT_TIMEOUT: u32 = 30_000u32
pub(crate) fn try_new(channel: ChannelOwner) -> Result<Self, Error>
pub(crate) async fn new_page(&self) -> Result<Weak<Page>, Arc<Error>>
pub(crate) async fn close(&self) -> Result<(), Arc<Error>>
pub(crate) async fn storage_state(&self) -> Result<StorageState, Arc<Error>>
pub(crate) async fn grant_permissions( &self, permissions: &[String], origin: Option<&str>, ) -> Result<(), Arc<Error>>
pub(crate) async fn clear_permissions(&self) -> Result<(), Arc<Error>>
pub(crate) async fn set_geolocation( &self, geolocation: Option<&Geolocation>, ) -> Result<(), Arc<Error>>
pub(crate) async fn set_offline(&self, offline: bool) -> Result<(), Arc<Error>>
pub(crate) async fn add_init_script( &self, script: &str, ) -> Result<(), Arc<Error>>
pub(crate) async fn set_extra_http_headers<T>( &self, headers: T, ) -> Result<(), Arc<Error>>
Source§impl BrowserContext
impl BrowserContext
pub(crate) fn browser(&self) -> Option<Weak<Browser>>
pub(crate) fn set_browser(&self, browser: Weak<Browser>)
pub(crate) fn pages(&self) -> Vec<Weak<Page>>
pub(super) fn push_page(&self, p: Weak<Page>)
pub(super) fn remove_page(&self, page: &Weak<Page>)
pub(crate) fn default_timeout(&self) -> u32
pub(crate) async fn set_default_timeout( &self, timeout: u32, ) -> Result<(), Arc<Error>>
fn on_close(&self, ctx: &Context) -> Result<(), Error>
fn on_route( &self, _ctx: &Context, _parmas: Map<String, Value>, ) -> Result<(), Error>
Trait Implementations§
Source§impl Debug for BrowserContext
impl Debug for BrowserContext
Source§impl EventEmitter for BrowserContext
impl EventEmitter for BrowserContext
type Event = Evt
fn tx(&self) -> Option<Sender<Self::Event>>
fn set_tx(&self, tx: Sender<Self::Event>)
fn new_tx(&self) -> (Sender<Self::Event>, Receiver<Self::Event>)
fn subscribe_event(&self) -> Receiver<Self::Event>
fn emit_event<E: Into<Self::Event>>(&self, e: E)
Source§impl RemoteObject for BrowserContext
impl RemoteObject for BrowserContext
fn channel(&self) -> &ChannelOwner
fn channel_mut(&mut self) -> &mut ChannelOwner
fn handle_event( &self, ctx: &Context, method: Str<Method>, params: Map<String, Value>, ) -> Result<(), Error>
fn guid(&self) -> &S<Guid>
fn context(&self) -> Result<Arc<Mutex<Context>>, Error>
Auto Trait Implementations§
impl !Freeze for BrowserContext
impl RefUnwindSafe for BrowserContext
impl Send for BrowserContext
impl Sync for BrowserContext
impl Unpin for BrowserContext
impl UnwindSafe for BrowserContext
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