https://bugzilla.wikimedia.org/show_bug.cgi?id=65428

--- Comment #2 from Michael Dale <md...@wikimedia.org> ---
jquery.triggerQueueCallback.js indeed pre-dates promises.  It's intent is to
trigger all events bidded to a given event name and once all respective events
issue the supplied callback, continue code execution. 

Is it possible to implement an event bind callback list with promises? .. i.e
imagine you want to let plugins supply player sources, and multiple such
plugins can add to your available sources.  

Within your get sources you have something like:

 $(this.embedPlayer).triggerQueueCallback('getSources', function(){
     // This callback is called after all plugins issue callback for getSources
     _this.handleSources(); 
 });

Within plugins that supply sources you presently have: 

 $(this).bind('getSources', function(event, callback){
     _this.asyncCallToGetSources(function( sources ){
         _this.embedPlayer.addSources( sources );
         callback();
    });
 });

Within triggerQueueCallback, we have the stack of binded getSources, and await
each callback before issuing the master callback. 

Most promise examples I have seen seem to pass a single event callback, is
there a clean way that each plugin to not have to know about the rest of the
promise chain?

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to