plugins/tungsten-event-outside/index.js
function getOutsideHandler(method) {
  var lastEventId = null;

  /**
   * If the event that is firing is not the same as the event that was fired on the element
   * execute the method
   * @param  {object} evt the event that's firing
   */
  var documentHandler = function(evt) {
    if (evt.eventId !== lastEventId) {
      method(evt);
    }
  };

  /**
   * Store the id of the event for comparison when documentHandler fires
   * @param  {object} evt the event firing on the element
   */
  var elementHandler = function(evt) {
    lastEventId = evt.eventId;
  };

  return {
    documentHandler: documentHandler,
    elementHandler: elementHandler
  };
}
function getOutsideHandler(method) {
  var lastEventId = null;

  /**
   * If the event that is firing is not the same as the event that was fired on the element
   * execute the method
   * @param  {object} evt the event that's firing
   */
  var documentHandler = function(evt) {
    if (evt.eventId !== lastEventId) {
      method(evt);
    }
  };

  /**
   * Store the id of the event for comparison when documentHandler fires
   * @param  {object} evt the event firing on the element
   */
  var elementHandler = function(evt) {
    lastEventId = evt.eventId;
  };

  return {
    documentHandler: documentHandler,
    elementHandler: elementHandler
  };
}
function getOutsideHandler ( method ) { var lastEventId = null ; /**
   * If the event that is firing is not the same as the event that was fired on the element
   * execute the method
   * @param  {object} evt the event that's firing
   */ var documentHandler = function ( evt ) { if ( evt . eventId !== lastEventId ) { method ( evt ) ; } } ; /**
   * Store the id of the event for comparison when documentHandler fires
   * @param  {object} evt the event firing on the element
   */ var elementHandler = function ( evt ) { lastEventId = evt . eventId ; } ; return { documentHandler : documentHandler , elementHandler : elementHandler } ; }
Track events firing on the element and document to determine if event is outside
@param  {Function} method handler to execute when event fires outside of the element
@return {object}          document and element handlers
Track events firing on the element and document to determine if event is outside