If this is a EventMessage it should return the related Event
172549
def get_event(self):
        

        if not self.is_event_message:
            return None

        # select a dummy field (eg. subject) to avoid pull unneccesary data
        query = self.q().select('subject').expand('event')

        url = self.build_url(self._endpoints.get('get_message').format(id=self.object_id))

        response = self.con.get(url, params=query.as_params())

        if not response:
            return None

        data = response.json()
        event_data = data.get(self._cc('event'))

        return Event(parent=self, **{self._cloud_data_key: event_data})
607199
public function hasMatchingEvent()
    {
        // Retrieve the 'event' part of the payload
        $eventData = $this->payload->get('event');

        // If the event type isn't 'message' (which should go through BotMan::hears),
        // build a GenericEvent and return it
        if (isset($eventData['type']) && $eventData['type'] !== 'message') {
            $eventPayload = json_encode($eventData);
            if ($eventPayload !== false) {
                $event = new GenericEvent($eventPayload);
                $event->setName($eventData['type']);

                return $event;
            }
        }

        // Otherwise, fall back to the parent implementation
        return parent::hasMatchingEvent();
    }
1164990
async def _next_event(self):
        
        while True:
            for event in self._connection.events():
                if isinstance(event, Message):
                    # check if we need to buffer
                    if event.message_finished:
                        return self._wrap_data(self._gather_buffers(event))
                    self._buffer(event)
                    break  # exit for loop
                else:
                    return event

            data = await self._sock.receive_some(4096)
            if not data:
                return CloseConnection(code=500, reason="Socket closed")
            self._connection.receive_data(data)
307923
def event_handler(msg: EventMsgDict) -> Event:
    """"""
    e = create_event_from_msg(msg)
    if e.currentTarget is None:
        if e.type not in ['mount', 'unmount']:
            id = msg['currentTarget']['id']
            logger.warning('No such element: wdom_id={}'.format(id))
        return e
    e.currentTarget.on_event_pre(e)
    e.currentTarget.dispatchEvent(e)
    return e
634189
def _event_received(self, ref, data):
        
        match = self._resolve_match_data(ref, data)
        if match:
            if self.flag_to_set:
                self.flag_to_set.set()
            if self.callback:
                self.callback(EventMatch(ref, data, match))
            if self.__forget:
                self.forget()
777993
def get_emitter(self, event_type: str) -> Callable:
        """"""
        if event_type not in self.events:
            raise ValueError(f'No event {event_type} in system.')
        return self.events.get_emitter(event_type)
1123026
function(oEvent) {
			var sEventId = oEvent.getParameter("EventId");

			if (sEventId === "messageSelected") {
				if (oEvent.getParameter("type") === "listenerAttached") {
					this._bEnableMessageSelect = true;
				} else if (oEvent.getParameter("type") === "listenerDetached") {
					this._bEnableMessageSelect = false;
				}

				this.fireEvent("_enableMessageSelect", {
					enabled : this._bEnableMessageSelect,
					notifier : this
				});
			}
		}
604477
function _returnMessage(message, target) {
                return this.circuit.run(function (success, failure) {
                    try {
                        var initiated = this.messageChannel.postMessage.call(this.messageChannel, message, target);

                        if (false === initiated) {
                            failure();
                        }
                        else {
                            success();
                        }
                    }
                    catch (ex) {
                        failure();
                    }
                }.bind(this));
            }
653766
def _process_event(self, event):
        
        if event.get('user'):
            event.user = self.lookup_user(event.get('user'))

        if event.get('channel'):
            event.channel = self.lookup_channel(event.get('channel'))

        if self.user.id in event.mentions:
            event.mentions_me = True

        event.mentions = [ self.lookup_user(uid) for uid in event.mentions ]

        return event
391055
def on_message(self, event):
        '''
        '''

        metadata = self._parse_metadata(event)
        message = Message(text=metadata['text'],
                          metadata=metadata).__dict__
        if message.get('text'):
            message['text'] = self.find_and_replace_userids(message['text'])
            message['text'] = self.find_and_replace_channel_refs(
                message['text']
            )
        return message
93685
function getRelatedTarget(e) {
    if (!e.timeStamp) {
        e.relatedTarget = e.type === "mouseover" ? e.fromElement : e.toElement;
    }
    return e.relatedTarget;
}
19541
function(e) {
		this._latestevent = e ? {
			type: e.type,
			value: e.target.value,
			checked: e.target.checked
		} : null;
	}
434497
def __callback(self, event, *args, **kwargs):
        # type: (str, *Any, **Any) -> Any
        
        comp_callback = self.context.get_callback(event)
        if not comp_callback:
            # No registered callback
            return True

        # Call it
        result = comp_callback(self.instance, *args, **kwargs)
        if result is None:
            # Special case, if the call back returns nothing
            return True

        return result
1335497
function( event ) {
	// Check if mouse(over|out) are still within the same parent element
	var parent = event.relatedTarget;

	// Traverse up the tree
	while ( parent && parent !== this ) {
		// Firefox sometimes assigns relatedTarget a XUL element
		// which we cannot access the parentNode property of
		try {
			parent = parent.parentNode;

		// assuming we've left the element since we most likely mousedover a xul element
		} catch(e) {
			break;
		}
	}

	if ( parent !== this ) {
		// set the correct event type
		event.type = event.data;

		// handle event if we actually just moused on to a non sub-element
		jQuery.event.handle.apply( this, arguments );
	}

}
834390
function(evt) {
  var elem = evt.currentTarget;
  var target = evt.target || evt.originalEvent.srcElement,
    related = evt.originalEvent.relatedTarget || evt.originalEvent.fromElement;
  if ((elem === target || contains(elem, target)) && !contains(elem, related)) {
    return true;
  }
  return false;
}
1361896
def create_event(msg: EventMsgDict) -> Event:
    
    proto = msg.get('proto', '')
    cls = proto_dict.get(proto, Event)
    e = cls(msg['type'], msg)
    return e
1092860
def event_exists(self, client, check):
        '''
        
        '''
        return self.api_request(
            'get',
            'events/{}/{}'.format(client, check)
            ).status_code == 200