Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise fired when all lazily components are loaded #45

Open
niespodd opened this issue Apr 14, 2019 · 0 comments
Open

Promise fired when all lazily components are loaded #45

niespodd opened this issue Apr 14, 2019 · 0 comments

Comments

@niespodd
Copy link

niespodd commented Apr 14, 2019

Is it possible to fire a callback when all components registered with registerAsync are loaded? So far I resorted to a dirty hack (which is not fully correct, but gives an idea what I want to do) shown below.

// ...
const build = containerBuilder.build();
Promise.all(Object.values(build._registrations).map((registration) => registration._operator()))
   .then(() => console.log("hurray"));

Is there a cleaner way to do that?

The reason I want this is that I want to avoid flickering when N different components are loaded individually. I want all of them to render at once and at the same time if a component is not used I'ld like to not download it's chunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant