3 ms·
>GlobalScope.launch { ... } I can't begin to express how sad that makes me. Your component should have its own scope that it destroys when it gets destroyed, o
by ohgodplsno 5y ago
>GlobalScope.launch { ... }
I can't begin to express how sad that makes me. Your component should have its own scope that it destroys when it gets destroyed, otherwise your coroutine leaks to the outside world when your component is gone from view.
- jillesvangurp 5y agoSure, but I wasn't going to fit a whole lot of boiler plate in a comment on HN to do that. Using Globalscope in a demo is perfectly valid; a lot of co-routine presentations do that as well. Normally, I'd use some named scope and life cycles associated with e.g. koin modules or a web worker. This is just something that I quickly knocked out that actually works. Also, this is not Android. There are not a whole lot of life cycle events beyond "page loaded".