```class Singleton private constructor(config: Sin...
# getting-started
d
Copy code
class Singleton private constructor(config: SingletonConfig){
    companion object {
        @Volatile private var instance: Singleton? = null

        fun sharedEngineWithConfig(config: NgpConfig): Singleton =
            instance ?: synchronized(this) {
                instance ?: Singleton(config).also {
                    instance = it
                }
            }
    }
}
🧵 2