Added an asynchronous each to the ExtensionHookModel

Review Request #8051 — Created March 10, 2016 and updated

imadueme
Djblets
release-0.9.x
8052
djblets, students

Added an asynchronous each to the ExtensionHookModel using jQuery Deferred Objects.
The addition of the new method allows client code to attach callback functions for
cases when the entire collection was successfully processed or cases when one or
more of the items in the collection failed to be processed.

This uses jQuery Deferred Objects so it should be compatible with non ES6 versions
of reviewboard/non-ES6 browsers.

Ensured that it worked with the new code added in the 'blocked' review requests to the right.
Exiting each still works.

Description From Last Updated

Can you rewrite this to use Args/Returns?

daviddavid

I think you should be able to just do return $.when(deferredObjs)

daviddavid
reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        djblets/static/djblets/js/extensions/models/extensionHookModel.js
    
    
    
    Tool: Pyflakes
    Ignored Files:
        djblets/static/djblets/js/extensions/models/extensionHookModel.js
    
    
  2. 
      
david
  1. 
      
  2. djblets/static/djblets/js/extensions/models/extensionHookModel.js (Diff revision 1)
     
     
     
     
     
     
     
     

    Can you rewrite this to use Args/Returns?

  3. I think you should be able to just do return $.when(deferredObjs)

    1. I actually thought so myself first, but, because $.when expects a variable number of deffered objects as parameters and defferedObjs is an array I used .apply to interpolate the array as many arguments rather than one.

  4. 
      
imadueme
Review request changed
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        djblets/static/djblets/js/extensions/models/extensionHookModel.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        djblets/static/djblets/js/extensions/models/extensionHookModel.js
    
    
  2. 
      
Loading...