pub struct Driver { /* private fields */ }
Expand description
Main connection to vertigo facilities - dependencies and rendering client (the browser).
This is in fact only a box for inner generic driver. This way a web developer don’t need to worry about the specific driver used, though usually it is the BrowserDriver which is used to create a Driver.
Additionally driver struct wraps Dependencies object.
Implementations
sourceimpl Driver
impl Driver
sourcepub fn fetch(&self, url: impl Into<String>) -> FetchBuilder
pub fn fetch(&self, url: impl Into<String>) -> FetchBuilder
Create new FetchBuilder.
Gets a cookie by name
Sets a cookie under provided name
sourcepub fn get_hash_location(&self) -> String
pub fn get_hash_location(&self) -> String
Retrieves the hash part of location URL from client (browser)
sourcepub fn push_hash_location(&self, path: String)
pub fn push_hash_location(&self, path: String)
Sets the hash part of location URL from client (browser)
sourcepub fn on_hash_route_change(
&self,
on_change: Box<dyn Fn(String)>
) -> DropResource
pub fn on_hash_route_change(
&self,
on_change: Box<dyn Fn(String)>
) -> DropResource
Set event handler upon hash location change
sourcepub fn set_interval(&self, time: u32, func: impl Fn() + 'static) -> DropResource
pub fn set_interval(&self, time: u32, func: impl Fn() + 'static) -> DropResource
Make func
fire every time
seconds.
sourcepub fn request(&self, url: impl Into<String>) -> RequestBuilder
pub fn request(&self, url: impl Into<String>) -> RequestBuilder
Create new RequestBuilder (more complex version of fetch)
pub fn sleep(&self, time: u32) -> FutureBox<()>ⓘNotable traits for FutureBox<T>impl<T> Future for FutureBox<T> type Output = T;
pub fn get_random(&self, min: u32, max: u32) -> u32
pub fn get_random_from<K: Clone>(&self, list: &[K]) -> Option<K>
sourcepub fn websocket<F: Fn(WebsocketMessage) + 'static>(
&self,
host: impl Into<String>,
callback: F
) -> DropResource
pub fn websocket<F: Fn(WebsocketMessage) + 'static>(
&self,
host: impl Into<String>,
callback: F
) -> DropResource
Initiate a websocket connection. Provided callback should handle a single WebsocketMessage.
sourcepub fn spawn(&self, future: impl Future<Output = ()> + 'static)
pub fn spawn(&self, future: impl Future<Output = ()> + 'static)
Spawn a future - thus allowing to fire async functions in, for example, event handler. Handy when fetching resources from internet.
sourcepub fn transaction<R, F: FnOnce(&Context) -> R>(&self, func: F) -> R
pub fn transaction<R, F: FnOnce(&Context) -> R>(&self, func: F) -> R
Fire provided function in a way that all changes in dependency graph made by this function will trigger only one run of updates, just like the changes were done all at once.
pub fn dom_access(&self) -> DomAccess
sourcepub fn on_after_transaction(&self, callback: impl Fn() + 'static)
pub fn on_after_transaction(&self, callback: impl Fn() + 'static)
Function added for diagnostic purposes. It allows you to check whether a block with a transaction is missing somewhere.