lib/common/streams/batchoperation.js
function CommonOperation(operationFunc, callback) {
  this.status = OperationState.Inited;
  this.operationId = -1;
  this._callbackArguments = null;
  var sliceStart = 2;
  if (azureutil.objectIsFunction(callback)) {
    this._userCallback = callback;
  } else {
    this._userCallback = null;
    sliceStart = 1;
  }
  var operationArguments = Array.prototype.slice.call(arguments).slice(sliceStart);
  this.run = function (cb) {
    if (!cb) cb = this._userCallback;
    operationArguments.push(cb);
    this.status = OperationState.RUNNING;
    operationFunc.apply(null, operationArguments);
    operationArguments = operationFunc = null;
  };
  
  this._fireUserCallback = function () {
    if (this._userCallback) {
      this._userCallback.apply(null, this._callbackArguments);
    }
    this._userCallback = this._callbackArguments = null;
  };
}
function CommonOperation(operationFunc, callback) {
  this.status = OperationState.Inited;
  this.operationId = -1;
  this._callbackArguments = null;
  var sliceStart = 2;
  if (azureutil.objectIsFunction(callback)) {
    this._userCallback = callback;
  } else {
    this._userCallback = null;
    sliceStart = 1;
  }
  var operationArguments = Array.prototype.slice.call(arguments).slice(sliceStart);
  this.run = function (cb) {
    if (!cb) cb = this._userCallback;
    operationArguments.push(cb);
    this.status = OperationState.RUNNING;
    operationFunc.apply(null, operationArguments);
    operationArguments = operationFunc = null;
  };
  
  this._fireUserCallback = function () {
    if (this._userCallback) {
      this._userCallback.apply(null, this._callbackArguments);
    }
    this._userCallback = this._callbackArguments = null;
  };
}
function CommonOperation ( operationFunc , callback ) { this . status = OperationState . Inited ; this . operationId = - 1 ; this . _callbackArguments = null ; var sliceStart = 2 ; if ( azureutil . objectIsFunction ( callback ) ) { this . _userCallback = callback ; } else { this . _userCallback = null ; sliceStart = 1 ; } var operationArguments = Array . prototype . slice . call ( arguments ) . slice ( sliceStart ) ; this . run = function ( cb ) { if ( ! cb ) cb = this . _userCallback ; operationArguments . push ( cb ) ; this . status = OperationState . RUNNING ; operationFunc . apply ( null , operationArguments ) ; operationArguments = operationFunc = null ; } ; this . _fireUserCallback = function ( ) { if ( this . _userCallback ) { this . _userCallback . apply ( null , this . _callbackArguments ) ; } this . _userCallback = this . _callbackArguments = null ; } ; }
Common operation wrapper
Common operation wrapper