on Change
Registers a listener that is called whenever the config changes.
The listener receives both the old and new config instances, enabling diff-based logic:
config.onChange { old, new ->
if (old.database.host != new.database.host) {
reconnectDatabase(new.database)
}
}Content copied to clipboard
Listeners are stored in a CopyOnWriteArrayList and are safe to register from any thread. They are invoked on the thread that triggered the reload.
Return
This ConfigRef for chaining.
Since
1.0
Parameters
listener
Callback receiving the old and new config instances.