ajacksified / ajacksified/Mediator.js

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

Offen
#42 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
460
Forks
75
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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:

``` javascript
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?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.