TODO This is tricky. Event is string here. Is transformed in
 event_subscriber from sym to string. we transform here egain to
 sym. Rethink this
 or user.notify....
176964
def perform(klass, id, event)
      "#{klass}_notifier".classify.constantize.create_notification(id: id, event: event.to_sym)
    end
616935
function (event) {
        var $target = $(event.currentTarget),
            nick,
            members = this.model.get('members'),
            member;

        event.stopPropagation();

        // Check this current element for a nick before resorting to the main message
        // (eg. inline nicks has the nick on its own element within the message)
        nick = $target.data('nick');
        if (!nick) {
            nick = $target.parent('.msg').data('message').nick;
        }

        // Make sure this nick is still in the channel
        member = members ? members.getByNick(nick) : null;
        if (!member) {
            return;
        }

        _kiwi.global.events.emit('nick:select', {
            target: $target,
            member: member,
            network: this.model.get('network'),
            source: 'message',
            $event: event
        })
        .then(_.bind(this.openUserMenuForNick, this, $target, member));
    }
295628
def _args_to_event(name_or_event, params={})
      raise ArgumentError, 'event parameters must be a hash' unless params.is_a?(Hash)

      case name_or_event
      when Event
        name_or_event.tap { |e| e.instance_variable_set(:@instance, self) }
      else
        Event.new(name_or_event, params.merge(instance: self))
      end
    end
255683
public int subscribe_event(final DeviceProxy deviceProxy, final String attributeName,
	            final int event, final CallBack callback, final String[] filters,
	            final boolean stateless) throws DevFailed {
        int id = 0;
        try {
            id = EventConsumerUtil.getInstance().subscribe_event(deviceProxy,
                    attributeName.toLowerCase(), event, callback, filters, stateless);
        } catch (final DevFailed e) {
            throw e;
        } catch (final Exception e) {
            e.printStackTrace();
            Except.throw_communication_failed(e.toString(), "Subscribe event on "
                + name(deviceProxy) + "/" + attributeName + " Failed !",
                "DeviceProxy.subscribe_event()");
        }
        return id;
    }
323381
function subscribeToEvents() {
    const socket = _socket.get(this);

    function onEventApiError(error) {
        dbg('Event API connection error: ' + JSON.stringify(error));
    }

    socket.on('pong', (latency) => {
        dbg(`Event API latency: ${latency} ms`);
    });
    socket.on('connect_error', onEventApiError);
    socket.on('error', onEventApiError);
    socket.on('disconnect', onEventApiError);
    socket.on('reconnect_error', onEventApiError);
    socket.on('reconnect_failed', () => {
        onEventApiError('Reconnecting to the Event API failed');
    });

    socket.on('new_receipt', receiptJSON => {
        const receipt = Receipt.from(receiptJSON, _provider.get(this));
        _eventEmitter.get(this).emit(EventNames.newReceipt, receipt);
    });
}
1183566
function onEvent(name, event) {
  console.log(name, JSON.stringify(event, null, 2));
}
964600
@Override
    protected boolean reSubscribe(EventChannelStruct event_channel_struct,
                                  EventCallBackStruct callback_struct) {
        boolean retVal = true;

        try {
            DeviceData subscriber_in = new DeviceData();
            String[] subscriber_info = new String[4];
            subscriber_info[0] = callback_struct.device.name();
            subscriber_info[1] = callback_struct.attr_name;
            subscriber_info[2] = "subscribe";
            subscriber_info[3] = callback_struct.event_name;
            subscriber_in.insert(subscriber_info);
            event_channel_struct.adm_device_proxy.command_inout("EventSubscriptionChange", subscriber_in);
            event_channel_struct.heartbeat_skipped = false;
            event_channel_struct.last_subscribed = System.currentTimeMillis();
            callback_struct.last_subscribed = event_channel_struct.last_subscribed;
        } catch (Exception e) {
            retVal = false;
        }
        return retVal;
    }
739174
function subscribe (obs, path, index, length, type, val, id, fire, origin, event, nocontext) {
  if (index === length) {
    // TODO added this to subscribe to key => this is probably not the best way to catch this
    if (obs.on) {
      obs.on('remove', function () {
        // null
        subscribe(origin, path, 0, length, type, val, id, false, origin, event)
      }, id, true, event, nocontext)
      obs.on(type, val, id, true, event, nocontext)
    }
    if (fire) {
      // **TODO** SUPER DIRTY
      // need to have some godamn arguments
      if (event === void 0) {
        var trigger = true
        event = new Event('data') // wrong
      }

      if (typeof val === 'function') {
        val.call(obs, obs.__input, event)
      } else {
        // weird gaurd
        if (val && val[0]) {
          val[0].call(obs, type === 'data' ? obs.__input : void 0, event, val[1])
        }
      }

      if (trigger) {
        event.trigger()
      }
    }
    return obs
  } else {
    let key = path[index]
    let property = obs[key]
    let result

    if (property && property.__input !== null) {
      result = subscribe(property, path, index + 1, length, type, val, id, fire, origin, event, nocontext)
    } else {
      let listenerType = key === 'parent' ? key : 'property'
      let listener = function (data, event) {
        let property = obs[key]
        if (property) {
          obs.off(listenerType, id, void 0, true)
          subscribe(property, path, index + 1, length, type, val, id, true, origin, event, nocontext)
        }
      }
      obs.on(listenerType, listener, id, true, event, nocontext)
    }

    // if sub is not fulfilled look in the reference
    if (!result) {
      let reference = ref(obs)
      if (reference) {
        subscribe(reference, path, index, length, type, val, id, fire, origin, event, nocontext)
      }
    }
  }
}
697487
public static Function<GHEventsSubscriber, Void> processEvent(final GHSubscriberEvent event) {
        return new NullSafeFunction<GHEventsSubscriber, Void>() {
            @Override
            protected Void applyNullSafe(@Nonnull GHEventsSubscriber subscriber) {
                try {
                    subscriber.onEvent(event);
                } catch (Throwable t) {
                    LOGGER.error("Subscriber {} failed to process {} hook, skipping...",
                            subscriber.getClass().getName(), event, t);
                }
                return null;
            }
        };
    }
1136650
def event_subscriber(event):
    
    def wrapper(method):
        Registry.register_event(event.name, event, method)
    return wrapper
883038
function Event(type) {
      var event = this;
      if (type instanceof Event) {
        return type;
      }
      return (event instanceof Event)
        ? _.assign(event, { 'timeStamp': _.now() }, typeof type == 'string' ? { 'type': type } : type)
        : new Event(type);
    }
412202
def _dispatch_event(self, event: LutronEvent, params: Dict):
    """"""
    for handler, context in self._subscribers:
      handler(self, context, event, params)
490491
public void subscribeToEvent(EventListener eventListener, Class<? extends AbstractTaskEvent> eventType) {
		this.outputGate.subscribeToEvent(eventListener, eventType);
	}
166687
def remove(self, event, subscriber):
        
        subs = self._subscribers
        if event not in subs:
            raise ValueError('No subscribers: %r' % event)
        subs[event].remove(subscriber)
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
810924
def notify_event(event, tuple)
      ev = [event, tuple]
      @notify_waiter.find_all_template(ev).each do |template|
        template.notify(ev)
      end
    end
651520
def _trigger_event(self, event):
    

    if event is None or event not in self.__listeners:
      raise ValueError('invalid event type: {0!r}'.format(event))

    # Check the event has not already been triggered, then mark
    # the event as triggered.
    if event in self.__event_set:
      raise RuntimeError('event already triggered: {0!r}'.format(event))
    self.__event_set.add(event)
    listeners = self.__listeners[event] + self.__listeners[None]

    # Remove one-off listeners.
    self.__listeners[event][:] = (l for l in self.__listeners[event] if not l.once)
    self.__listeners[None][:] = (l for l in self.__listeners[None] if not l.once)

    for listener in listeners:
      # XXX: What to do on exceptions? Catch and make sure all listeners
      # run through? What to do with the exception(s) then?
      listener.callback(self, event)