src/basis/dom/event.js
function addGlobalHandler(eventType, handler, thisObject){
    var handlers = globalHandlers[eventType];
    if (handlers)
    {
      // search for similar handler, returns if found (prevent for handler dublicates)
      for (var i = 0, item; item = handlers[i]; i++)
        if (item.handler === handler && item.thisObject === thisObject)
          return;
    }
    else
    {
      if (noCaptureScheme)
        // nothing to do, but it will provide observeGlobalEvents calls if other one doesn't
        addHandler(document, eventType, $null);
      else
        document.addEventListener(eventType, observeGlobalEvents, true);

      handlers = globalHandlers[eventType] = [];
    }

    // add new handler
    handlers.push({
      handler: handler,
      thisObject: thisObject
    });
  }
function addGlobalHandler(eventType, handler, thisObject){
    var handlers = globalHandlers[eventType];
    if (handlers)
    {
      // search for similar handler, returns if found (prevent for handler dublicates)
      for (var i = 0, item; item = handlers[i]; i++)
        if (item.handler === handler && item.thisObject === thisObject)
          return;
    }
    else
    {
      if (noCaptureScheme)
        // nothing to do, but it will provide observeGlobalEvents calls if other one doesn't
        addHandler(document, eventType, $null);
      else
        document.addEventListener(eventType, observeGlobalEvents, true);

      handlers = globalHandlers[eventType] = [];
    }

    // add new handler
    handlers.push({
      handler: handler,
      thisObject: thisObject
    });
  }
function addGlobalHandler ( eventType , handler , thisObject ) { var handlers = globalHandlers [ eventType ] ; if ( handlers ) { // search for similar handler, returns if found (prevent for handler dublicates) for ( var i = 0 , item ; item = handlers [ i ] ; i ++ ) if ( item . handler === handler && item . thisObject === thisObject ) return ; } else { if ( noCaptureScheme ) // nothing to do, but it will provide observeGlobalEvents calls if other one doesn't addHandler ( document , eventType , $null ) ; else document . addEventListener ( eventType , observeGlobalEvents , true ) ; handlers = globalHandlers [ eventType ] = [ ] ; } // add new handler handlers . push ( { handler : handler , thisObject : thisObject } ) ; }
Adds global handler for some event type.
@param {string} eventType
@param {function(event)} handler
@param {object=} thisObject Context for handler
Adds global handler for some event type .