INNER CODE UNIT · Rust
new
versotile-org/verso · verso/src/lib.rs:178
pub fn new(verso_path: impl AsRef<Path>, initial_url: url::Url) -> Self {
Self::create(verso_path, initial_url, VersoviewSettings::default())
}
/// Exit
pub fn exit(&self) -> Result<(), Box<ipc_channel::ErrorKind>> {
self.sender.send(ToVersoMessage::Exit)
}
/// Listen on close requested from the OS,
/// if you decide to use it, verso will not close the window by itself anymore,
/// so make sure you handle it properly by either do your own logic or call [`Self::exit`] as a fallback
pub fn on_close_requested(
&self,
callback: impl Fn() + Send + 'static,
) -> Result<(), Box<ipc_channel::ErrorKind>> {
let old_listener = self
.event_listeners