Created
March 7, 2020 14:16
-
-
Save DawnImpulse/8f3e73f5fd2327c2c9d061b1e08fe800 to your computer and use it in GitHub Desktop.
Revisions
-
DawnImpulse created this gist
Mar 7, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ package com.dawnimpulse.wallup.utils.reusables import kotlin.properties.Delegates class Live<T>(private val value1: T) { private lateinit var change: (T) -> Unit var value: T by Delegates.observable(value1) { _, _, new -> if (::change.isInitialized) change(new) } fun onChange(change: (T) -> Unit) { this.change = change } }