Skip to main content

on_change

Function on_change 

Source
pub fn on_change(key: &str, callback: impl Fn(&Value) + Send + 'static)
Expand description

Subscribe to changes for a specific config key (opt-in).

The callback fires when update is called for the given key. Modules that need hot-reload subscribe at init; modules that don’t simply use the OnceLock pattern and ignore change events.

The callback receives the new effective value as JSON.