function invokeCallback(savedArgs, callbackParameter, var_args) {
  var callbackArguments = Array.prototype.slice.call(arguments, 2);
  return callFunction(function() {
    savedArgs.arguments[callbackParameter].apply(null, callbackArguments);

    // Mock4JS does not clear the saved args after invocation.
    // To allow reuse of the same SaveMockArguments for multiple
    // invocations with similar arguments, clear them here.
    savedArgs.arguments.splice(0, savedArgs.arguments.length);
  });
}
/**
 * Syntactic sugar for use with will() on a Mock4JS.Mock.
 * Creates an action for will() that invokes a callback that the tested code
 * passes to a mocked function.
 * @param {SaveMockArguments} savedArgs Arguments that will contain the
 *     callback once the mocked function is called.
 * @param {number} callbackParameter Index of the callback parameter in
 *     |savedArgs|.
 * @param {...Object} var_args Arguments to pass to the callback.
 * @return {CallFunctionAction} Action for use in will().
 */
Syntactic sugar for use with will() on a Mock4JS.Mock.
Creates an action for will() that invokes a callback that the tested code
passes to a mocked function.
@param {SaveMockArguments} savedArgs Arguments that will contain the
callback once the mocked function is called.
@param {number} callbackParameter Index of the callback parameter in
|savedArgs|.
@param {...Object} var_args Arguments to pass to the callback.
@return {CallFunctionAction} Action for use in will().
Syntactic sugar for use with will () on a Mock4JS . Mock . Creates an action for will () that invokes a callback that the tested code passes to a mocked function . @param { SaveMockArguments } savedArgs Arguments that will contain the callback once the mocked function is called . @param { number } callbackParameter Index of the callback parameter in |savedArgs| . @param { ... Object } var_args Arguments to pass to the callback . @return { CallFunctionAction } Action for use in will () .
function invokeCallback(savedArgs, callbackParameter, var_args) {
  var callbackArguments = Array.prototype.slice.call(arguments, 2);
  return callFunction(function() {
    savedArgs.arguments[callbackParameter].apply(null, callbackArguments);
    savedArgs.arguments.splice(0, savedArgs.arguments.length);
  });
}
function invokeCallback ( savedArgs , callbackParameter , var_args ) { var callbackArguments = Array . prototype . slice . call ( arguments , 2 ) ; return callFunction ( function ( ) { savedArgs . arguments [ callbackParameter ] . apply ( null , callbackArguments ) ; savedArgs . arguments . splice ( 0 , savedArgs . arguments . length ) ; } ) ; }
Syntactic sugar for use with will() on a Mock4JS.Mock.
Syntactic sugar for use with will () on a Mock4JS . Mock .
// Mock4JS does not clear the saved args after invocation. // To allow reuse of the same SaveMockArguments for multiple // invocations with similar arguments, clear them here.