Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Promise fired when all lazily components are loaded  #45

@niespodd

Description

@niespodd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions