B2G/gecko/accessible/tests/mochitest/events.js
/**
 * Executes the function when requested event is handled.
 *
 * @param aEventType  [in] event type
 * @param aTarget     [in] event target
 * @param aFunc       [in] function to call when event is handled
 * @param aContext    [in, optional] object in which context the function is
 *                    called
 * @param aArg1       [in, optional] argument passed into the function
 * @param aArg2       [in, optional] argument passed into the function
 */
Executes the function when requested event is handled.
Executes the function when requested event is handled .
function waitForEvent(aEventType, aTarget, aFunc, aContext, aArg1, aArg2)
{
  var handler = {
    handleEvent: function handleEvent(aEvent) {
      if (aTarget) {
        if (aTarget instanceof nsIAccessible &&
            aTarget != aEvent.accessible)
          return;
        if (aTarget instanceof nsIDOMNode &&
            aTarget != aEvent.DOMNode)
          return;
      }
      unregisterA11yEventListener(aEventType, this);
      window.setTimeout(
        function ()
        {
          aFunc.call(aContext, aArg1, aArg2);
        },
        0
      );
    }
  };
  registerA11yEventListener(aEventType, handler);
}
function waitForEvent ( aEventType , aTarget , aFunc , aContext , aArg1 , aArg2 ) { var handler = { handleEvent : function handleEvent ( aEvent ) { if ( aTarget ) { if ( aTarget instanceof nsIAccessible && aTarget != aEvent . accessible ) return ; if ( aTarget instanceof nsIDOMNode && aTarget != aEvent . DOMNode ) return ; } unregisterA11yEventListener ( aEventType , this ) ; window . setTimeout ( function ( ) { aFunc . call ( aContext , aArg1 , aArg2 ) ; } , 0 ) ; } } ; registerA11yEventListener ( aEventType , handler ) ; }
Executes the function when requested event is handled.
Executes the function when requested event is handled .