aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-07-04 20:17:58 +1000
committerGitHub <noreply@github.com>2023-07-04 12:17:58 +0200
commit1a38f3d79d6cdbe90455191712fa71f0ac1aa7e6 (patch)
tree5bbfc980878605a322965e84e4e17f1ce511059c /src/main/java/at/hannibal2/skyhanni/utils
parenta8b5f0c4aaa918e4264beaa2c3295d25ef3b71ec (diff)
downloadskyhanni-1a38f3d79d6cdbe90455191712fa71f0ac1aa7e6.tar.gz
skyhanni-1a38f3d79d6cdbe90455191712fa71f0ac1aa7e6.tar.bz2
skyhanni-1a38f3d79d6cdbe90455191712fa71f0ac1aa7e6.zip
Merge pull request #284
* custom text box * grammar * renamed thing * may as well fix this here as well
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index c1309d573..77a47b895 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -275,6 +275,10 @@ object LorenzUtils {
whenChanged { _, _ -> observer.run() }
}
+ fun <T> Property<out T>.afterChange(observer: T.() -> Unit) {
+ whenChanged { _, new -> observer(new) }
+ }
+
fun <K, V> Map<K, V>.editCopy(function: MutableMap<K, V>.() -> Unit) =
toMutableMap().also { function(it) }.toMap()