package net.shadowfacts.cacao.util.properties import kotlin.reflect.KProperty /** * @author shadowfacts */ class ObservableLazyProperty(val create: () -> Value, val onCreate: () -> Unit) { var storage: Value? = null operator fun getValue(thisRef: Any, property: KProperty<*>): Value { if (storage == null) { storage = create() onCreate() } return storage!! } }