Could I know somehow is module will be override by...
# koin
m
Could I know somehow is module will be override by another module or already loaded? I'm trying to load modules when scope creates. F.e we enter some screen, load module with scope and when we left the screen, scope closes, module unloads. I have a trouble when I open few similar screens, and load modules on each of them. Then when we left the screen, module unloads and previous ones can not provide instances anymore. In conclusion, how can I know module already loaded in order not to load it again or just to be sure that it's hasn't been loaded before?
a
on a module variable there is a
isLoaded
value
you can activate Koin logs if you need more insights
m
Oh, thanks a lot, my bad:)
a
no pb 👌
m
As I can see in implemenation of Module.kt isLoaded is true if mappings count is not zero. As for me it will be always true if our module is not empty. F.e we add single. In implementation of Single "indexPrimaryType" method calls, then "saveMappings" and there mappings are inflated => mappings not empty => isLoaded == true
a
yes, not helping then 🤔
m
@arnaud.giuliani Maybe add a flag when module is loaded with loadModules or on koin startup?
a
perhaps yes 🤔