code: function createDisposable(request, idx) {
      var disposed = false;
      return function() {
          if (disposed || request._disposed) {
              return;
          }
  
          disposed = true;
          request._callbacks[idx] = null;
          request._optimizedPaths[idx] = [];
          request._requestedPaths[idx] = [];
  
          // If there are no more requests, then dispose all of the request.
          var count = --request._count;
          var disposable = request._disposable;
          if (count === 0) {
              // looking for unsubscribe here to support more data sources (Rx)
              if (disposable.unsubscribe) {
                  disposable.unsubscribe();
              } else {
                  disposable.dispose();
              }
              request.requestQueue.removeRequest(request);
          }
      };
  }
docs: Creates a more efficient closure of the things that are needed.  So the request and the idx.  Also prevents code duplication.