diff src/name/blackcap/exifwasher/Misc.kt @ 20:965435b85a69

Get rid of some stuttering.
author David Barts <n5jrn@me.com>
date Sun, 12 Apr 2020 11:46:12 -0700
parents 39b977021ea1
children 539c3641c539
line wrap: on
line diff
--- a/src/name/blackcap/exifwasher/Misc.kt	Sat Apr 11 16:12:59 2020 -0700
+++ b/src/name/blackcap/exifwasher/Misc.kt	Sun Apr 12 11:46:12 2020 -0700
@@ -23,7 +23,7 @@
  * needed in Swing, because some vars inevitably need to be declared at
  * outer levels but initialized in the Swing event dispatch thread.
  */
-class SetOnce<T: Any>: ReadWriteProperty<Any?,T> {
+class SetOnceImpl<T>: ReadWriteProperty<Any?,T> {
     private var setOnceValue: T? = null
 
     override operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
@@ -43,6 +43,8 @@
     }
 }
 
+fun <T> setOnce(): SetOnceImpl<T> = SetOnceImpl<T>()
+
 /**
  * Run something in the Swing thread, asynchronously.
  * @param block lambda containing code to run