Expand description
Creation and management of application windows. Provides control such as maximizing, minimizing and restoring application windows, changing the title, size and position, window transparency, control over kiosk and full-screen modes, window image capture, iframe control and print options control including print header, footer and other options.
Synopsis
use workflow_wasm::prelude::*;
// Get the current window
let win = nw_sys::window::get();
// Listen to the minimize event
let minimize_callback = callback!(|| {
log_info!("Window is minimized");
});
win.on("minimize", minimize_callback.as_ref());
// Minimize the window
win.minimize();
// Unlisten the minimize event
win.remove_all_listeners_with_name("minimize");
// Create a new window and get it
let options = nw_sys::window::Options::new()
.title("Test window");
let open_callback = callback!(|new_win:nw_sys::Window| {
// And listen to new window's focus event
let focus_callabck = callback!(||{
log_info!("New window is focused");
});
new_win.on("focus", focus_callabck.as_ref());
});
nw_sys::window::open_with_options_and_callback(
"https://github.com",
&options,
open_callback.as_ref()
);
// save these `open_callback`, `focus_callabck`
// and `minimize_callback` somewhere
app.push_callback(open_callback);
app.push_callback(minimize_callback);
Structs
Window Capture Config
Window open options
Window Print options
Screenshot Config
Interface for managing application windows. For usage example please refer to nw_sys::window
Enums
Functions
Get current window.
Get all windows with a callback function whose parameter is an array of nw::Window object.
Open new window
Open window with options
Open window with options and callback.