(hot take) I want to use InjectionToken for almost all my services
3/30/2023When we need to interact with an external API (DOM, Canvas, etc...) that is imperative and the interaction needs to have: initialization, clean up, and final disposal. We need to react to Observable emissions. With ngrx/component-store, we have effect() to setup an effect that can react to Observable emissions. Combined with tap(), we then have a somewhat robust solution, but there's still something missing. Considering the following use-case: I have a stream of a HTML element { width, height }, eg: size$. Based on size$, I want to registerAnimationFrame to start some animations. On size$ changes, I want to clean up the previously registered animation with cancelAnimationFrame() based on some comparison logic between the prevous size versus the new size
11/1/2022