Skip to content

Commit 6d746ca

Browse files
committed
Notice for value changes
1 parent 79d2c83 commit 6d746ca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

common/src/main/kotlin/com/lambda/config/AbstractSetting.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ abstract class AbstractSetting<T : Any>(
100100
value = gson.fromJson(serialized, type)
101101
}
102102

103+
/**
104+
* Will only register changes of the variable, not the content of the variable!
105+
* E.g., if the variable is a list, it will only register if the list reference changes, not if the content of the list changes.
106+
*/
103107
fun onValueChange(block: SafeContext.(from: T, to: T) -> Unit) {
104108
listeners.add(ValueListener(true) { from, to ->
105109
runSafe {

0 commit comments

Comments
 (0)