pub struct Driver { /* private fields */ }
Expand description
Main connection to vertigo facilities - dependencies and rendering client (the browser).
Implementations§
source§impl Driver
impl Driver
Gets a cookie by name
Gets a JsJson cookie by name
Sets a cookie under provided name
Sets a cookie under provided name
sourcepub fn history_back(&self)
pub fn history_back(&self)
Go back in client’s (browser’s) history
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_get(&self, url: impl Into<String>) -> RequestBuilder
pub fn request_get(&self, url: impl Into<String>) -> RequestBuilder
Create new RequestBuilder for GETs (more complex version of fetch)
sourcepub fn request_post(&self, url: impl Into<String>) -> RequestBuilder
pub fn request_post(&self, url: impl Into<String>) -> RequestBuilder
Create new RequestBuilder for POSTs (more complex version of fetch)
pub fn sleep(&self, time: u32) -> FutureBox<()> ⓘ
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
) -> DropResource
pub fn on_after_transaction( &self, callback: impl Fn() + 'static ) -> DropResource
Function added for diagnostic purposes. It allows you to check whether a block with a transaction is missing somewhere.