Build an event object for the given type and data
@param   {string} type The event type
@param   {Object} data The event data
@returns {Object}      The event object
485876
function buildEventObject(type, data) {
        var isDefaultPrevented = false;
        return {
            type: type,
            data: data,

            /**
             * Prevent the default action for this event
             * @returns {void}
             */
            preventDefault: function () {
                isDefaultPrevented = true;
            },

            /**
             * Return true if preventDefault() has been called on this event
             * @returns {Boolean}
             */
            isDefaultPrevented: function () {
                return isDefaultPrevented;
            }
        };
    }
699864
function (type, create) {
            var self = this, customEvent, customEventObservables = self.getCustomEvents();
            customEvent = customEventObservables && customEventObservables[type];
            if (!customEvent && create) {
                customEvent = customEventObservables[type] = new CustomEventObservable({
                    currentTarget: self,
                    type: type
                });
            }
            return customEvent;
        }
1301392
function CoreEvent(typeArg, detail) {
	if (detail == undefined) {
		detail = {};
	}
	/**
	 * Error:
	 * Failed to construct 'CustomEvent': Please use the 'new' operator, this 
	 * DOM object constructor cannot be called as a function.
	 * 
	 * In reason of that the browser did not allow to extend CustomEvent in
	 * common way, we use our event class only as constant holder. 
	 */
	return new CustomEvent(typeArg, { detail: detail });
}
1190742
function (evtType) {
        var self = this;
        this.cpt["on" + evtType] = function (evtData) {
            if (!evtData) {
                evtData = {};
            }
            if (!evtData.type) {
                evtData.type = evtType;
            }
            if (self.nodeInstance && self.nodeInstance.onEvent) {
                self.nodeInstance.onEvent(evtData);
            }
        };
    }
1309509
public function onFrame($data, $type)
    {
        $ws = $this;
        $req = json_decode($data, true);
        if ($req['type'] === 'subscribe') {
            $eventName = $req['event'];
            $this->appInstance->pubsub->sub($req['event'], $this, function ($data) use ($ws, $eventName) {
                $ws->sendObject([
                    'type' => 'event',
                    'event' => $eventName,
                    'data' => $data,
                ]);
            });
        }
    }
753665
function attachEvent(obj, type, func, scope)
    {
        function handler(e)
        {
            e = e || window.event;

            if (!e.target)
            {
                e.target = e.srcElement;
                e.preventDefault = function()
                {
                    this.returnValue = false;
                };
            }

            func.call(scope || window, e);
        };

        if (obj.attachEvent)
        {
            obj.attachEvent('on' + type, handler);
        }
        else
        {
            obj.addEventListener(type, handler, false);
        }
    }
1030609
function createEventTransform(data) {
      return inspect(onComplete);

      function onComplete(filename) {
        isUsed = true;
        var now = Date.now();
        var events = eventsByFilename[filename] = eventsByFilename[filename] || [];
        events.push(now, data);
      }
    }
1372843
def create(cls, data):
        
        try:
            json_data = json.loads(data)
        except ValueError as err:
            logging.debug("Failed to load json data: %s: [%s]", str(err), data)
            json_data = json.loads(ErrorEvent.error_json(err))

        if "type" not in json_data:
            raise GerritError("`type` not in json_data")
        name = json_data["type"]
        if name not in cls._events:
            name = 'unhandled-event'
        event = cls._events[name]
        module_name = event[0]
        class_name = event[1]
        module = __import__(module_name, fromlist=[module_name])
        klazz = getattr(module, class_name)
        return klazz(json_data)
985634
function(type, eventInit) {
    var event = extend(FileUploadEvent.DEFAULT, new EventBase(type), eventInit);

    event.prototype = EventBase.prototype;
    event.constructor = FileUploadEvent;

    return event;
}
680308
function setupEvent(event_type) {
  var event = void 0;

  if (exists(document.createEvent)) {
    // modern browsers
    event = document.createEvent('HTMLEvents');
    event.initEvent(event_type, true, true);
  } else if (exists(document.createEventObject)) {
    // IE9-
    event = document.createEventObject();
    event.eventType = event_type;
    event.eventName = event_type;
  }
  return event;
}
1368819
function getData(event) {
        var types = toArray(event.dataTransfer.types);

        return types.reduce(function (collection, type) {
          // Get data.
          var data = event.dataTransfer.getData(type);

          // Get data format.
          var format = /(.*)\//.exec(type);
          format = format ? format[1] : null;

          // Parse data.
          if (format === 'json') data = JSON.parse(data);

          collection[type] = data;

          return collection;
        }, {});
      }
1091513
function MessageEvent (type, eventInitDict) {
  Object.defineProperty(this, 'type', { writable: false, value: type, enumerable: true })
  for (var f in eventInitDict) {
    if (eventInitDict.hasOwnProperty(f)) {
      Object.defineProperty(this, f, { writable: false, value: eventInitDict[f], enumerable: true })
    }
  }
}
831033
function(element, type, handler) {
    var types = type.split(' ');
    Utils.each(types, function(type){
      element.addEventListener(type, handler, false);
    });
  }
423842
function(type, data) {

			var handlers,
				i,
				len,
				event = {
					type: type,
					data: data
				};

			// if there are handlers for the event, call them in order
			handlers = this._handlers[event.type];
			if (handlers instanceof Array) {
				// @NOTE: do a concat() here to create a copy of the handlers array,
				// so that if another handler is removed of the same type, it doesn't
				// interfere with the handlers array during this loop
				handlers = handlers.concat();
				for (i = 0, len = handlers.length; i < len; i++) {
					handlers[i].call(this, event);
				}
			}
		}
1036828
function bind (type, callback) {
        if (!events.has(type)) {
          throw new Error('Unknown event: ' + type);
        }

        if (typeof callback !== 'function') {
          throw new Error('Callback must be a function, instead got: ' + (typeof callback));
        }

        var eventsOfType = events.get(type, Immutable.List());

        if (!eventsOfType.includes(callback)) {
          events = events.set(type, eventsOfType.push(callback));
        }

        return self;
      }
382387
function Event(type, eventInitDict) {
  this.type = type;
  this.bubbles = eventInitDict.bubbles;
  this.cancelable = eventInitDict.cancelable;

  this.target = null;
  this.currentTarget = null;
  this.eventPhase = eventPhases.NONE;

  this.timestamp = now();
}
670767
function(type, data) {
		var test = 'HTML' + (type || '').replace(
			/^[a-z]/,
			function(m) {
				return m.toUpperCase();
			}

		) + 'Element';

		if (!data) {
			return false;
		}

		if (window[test]) {
			return data instanceof window[test];
		}
		else if (window.Element) {
			return data instanceof window.Element && (!type || (data.tagName && data.tagName.toLowerCase() === type));
		}
		else {
			return (!(data instanceof Object || data instanceof Array || data instanceof String || data instanceof Number) && data.tagName && data.tagName.toLowerCase() === type);
		}
	}