zng/update.rs
1//! App update service and other types.
2//!
3//! The [`UPDATES`] service can execute arbitrary futures and setup update handlers. It can also be used to request update,
4//! info rebuild, layout and render for any widget. Note that from inside the widget you should use the [`WIDGET`] service instead,
5//! as it is more efficient.
6//!
7//! The example below setups a handler that is called every app update.
8//!
9//! ```
10//! use zng::prelude::*;
11//! # let _scope = APP.defaults();
12//!
13//! zng::update::UPDATES
14//! .on_pre_update(app_hn!(|args: &zng::update::UpdateArgs, _| {
15//! println!("pre_update #{}", args.count);
16//! }))
17//! .perm();
18//! ```
19//!
20//! Updates are coalesced, multiple requests for the same widget will cause it to only update once, and multiple widgets
21//! can update on the same pass. See the [Main Loop] docs in the `app` module for more details.
22//!
23//! [`WIDGET`]: crate::widget::WIDGET
24//! [Main Loop]: crate::app#main-loop
25//!
26//! # Full API
27//!
28//! See [`zng_app::update`] for the full update API.
29
30pub use zng_app::update::{
31 ContextUpdates, EventUpdate, InfoUpdates, LayoutUpdates, OnUpdateHandle, RenderUpdates, UPDATES, UpdateArgs, UpdateDeliveryList,
32 UpdateOp, UpdateSubscribers, UpdatesTraceUiNodeExt, WeakOnUpdateHandle, WidgetUpdates,
33};