B2G/gecko/testing/marionette/marionette-listener.js
/**
 * Function to start multi-action
 */
Function to start multi-action
Function to start multi - action
function multiAction(msg) {
  let command_id = msg.json.command_id;
  let args = msg.json.value;
  let maxlen = msg.json.maxlen;
  try {
    let commandArray = elementManager.convertWrappedArguments(args, curWindow);
    let concurrentEvent = [];
    let temp;
    for (let i = 0; i < maxlen; i++) {
      let row = [];
      for (let j = 0; j < commandArray.length; j++) {
        if (commandArray[j][i] != undefined) {
          temp = commandArray[j][i];
          temp.unshift(j);
          row.push(temp);
        }
      }
      concurrentEvent.push(row);
    }
    let pendingTouches = [];
    setDispatch(concurrentEvent, pendingTouches, command_id);
  }
  catch (e) {
    sendError(e.message, e.code, e.stack, msg.json.command_id);
  }
}
function multiAction ( msg ) { let command_id = msg . json . command_id ; let args = msg . json . value ; let maxlen = msg . json . maxlen ; try { let commandArray = elementManager . convertWrappedArguments ( args , curWindow ) ; let concurrentEvent = [ ] ; let temp ; for ( let i = 0 ; i < maxlen ; i ++ ) { let row = [ ] ; for ( let j = 0 ; j < commandArray . length ; j ++ ) { if ( commandArray [ j ] [ i ] != undefined ) { temp = commandArray [ j ] [ i ] ; temp . unshift ( j ) ; row . push ( temp ) ; } } concurrentEvent . push ( row ) ; } let pendingTouches = [ ] ; setDispatch ( concurrentEvent , pendingTouches , command_id ) ; } catch ( e ) { sendError ( e . message , e . code , e . stack , msg . json . command_id ) ; } }
Function to start multi-action
Function to start multi - action
// maxlen is the longest action chain for one finger // unwrap the original nested array // add finger id to the front of each action, i.e. [finger_id, action, element] // now concurrent event is made of sets where each set contain a list of actions that need to be fired. // note: each action belongs to a different finger // pendingTouches keeps track of current touches that's on the screen