What is Nostr?
P-Y /
npub19ww…g5sa
2024-01-17 06:31:16
in reply to nevent1q…u5ak

P-Y on Nostr: What's that? Oh you want modules? Add the factory maps! ``` val logModule = Linker() ...

What's that? Oh you want modules?

Add the factory maps!

```
val logModule = Linker()
logModule.installSingleton {
CoffeeLogger()
}

val partsModule = Linker()
partsModule.installSingleton<Heater> {
ElectricHeater(get())
}
partsModule.install<Pump> {
Thermosiphon(get(), get())
}

val appModule = Linker()
appModule.install {
CoffeeMaker(get(), get(), get())
}

appModule.factories += logModule.factories + partsModule.factories

val maker = appModule.get<CoffeeMaker>()
maker.brew()
```
Author Public Key
npub19wwxc29uufy6rmegf9aza3hkcqdu00s8yyfyhr88mglptysgp3tsz7g5sa