Skip to content

Is there a way to wait until all listeners have completed (async) tasks? #42

Description

@julkue

Hi,

I am using MediatorJS with requireJS modules. After a page change all my listeners will be informed and they will execute some tasks. Some tasks are async. This has the effect that this will not work constantly:

                    showLoader();

                    // Publish page change
                    mediator_.publish(
                        config_.mediator.channel.afterContentNavigation,
                        {
                            "content": $frameDoc,
                            "page": page
                        }
                    );

                    hideLoader();

As you can imagine if a components listens to the afterContentNavigation it will be triggered sure, but the hideLoader() function will may be called before the async task is completed.

Is there a way to handle such things with Mediator-JS?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions