Expand description
This module contains all event related types.
To understand how events work in BrowserWindow, here is a short summary.
The BrowserWindow
handle
contains a bunch of functions that return different event objects, and then
the event object can be used to register the callback at.
Each event object has the
register
method to register a
closure to be executed on the occurence of the event.
use browser_window::{browser::*, prelude::*};
fn example(bw: BrowserWindow) {
bw.on_message()
.register(|h: &BrowserWindowHandle, e: MessageEventArgs| {
// .. code here ...
});
}
There is also a
register_async
method, which can be useful in async code:
use browser_window::{browser::*, prelude::*};
fn async_example(bw: BrowserWindow) {
bw.on_message()
.register_async(|h: BrowserWindow, e: MessageEventArgs| async move {
// .. code here ...
});
}
Also, keep in mind that if the register
or register_async
methods are
not available, that means that event object does not implement EventExt
,
which in turn means that the corresponding event is not supported for the
browser framework that has been selected.
CEF supports all events, unless it is stated that it is not implemented yet. The other browser frameworks only support a subset of what is supported for CEF. The reason for this is that CEF is simply the most cross-platform framework out there, so it gets the most care.