addSingleton

abstract fun addSingleton(ref: RefMaker? = null, sync: Boolean = true, creator: NoArgBindingDI<Any>.() -> T)

Adds a singleton binding to the set.

Parameters

ref

The reference maker to use (defaults to strong reference if null).

sync

Whether the singleton should be thread-safe.

creator

The function that creates the singleton instance.