receivedLazy

inline fun <T : Any, V> receivedLazy(mode: LazyThreadSafetyMode = LazyThreadSafetyMode.SYNCHRONIZED, crossinline initialize: (T) -> V): ReadOnlyProperty<T, V>

Passes the receiver of T to initialize a lazy value easily with mode.

Usage example:

val Context.database by receivedLazy{ context -> DatabaseBuilder.build(context, ...) }

inline fun <T : Any, V> receivedLazy(lock: Any, crossinline initialize: (T) -> V): ReadOnlyProperty<T, V>

Passes the receiver of T to initialize a lazy value easily with lock.

Usage example:

val Context.database by receivedLazy{ context -> DatabaseBuilder.build(context, ...) }