OpenWaterFoundation / owf-app-infomapper-ng

Open Water Foundation InfoMapper web application for menu-driven maps and visualizations, using Angular
GNU General Public License v3.0
1 stars 2 forks source link

Implement APP_INITIALIZER #375

Open Nightsphere opened 3 years ago

Nightsphere commented 3 years ago

Developing SNODAS has helped me understand Angular in a few ways I hadn't before. SNODAS uses a DI (dependency injection) token that will perform any tasks, including asynchronous ones, as the app initializes. This makes it so any necessary data is already obtained by the app before it's needed, so there's no need for components to wait to use it. This is especially helpful when using configuration data, which the InfoMapper has quite a lot of.

As of this issue creation, there are still a few unwanted setTimeout functions being called. Using Angular's APP_INITIALIZER should be able to finally let the InfoMapper break free from those.