Listen for events
962084
def listen(self):
        ''''''
        for message in Listener.listen(self):
            logger.debug('Message: %s', message)
            # Strip off the 'namespace' from the channel
            channel = message['channel'][len(self.namespace):]
            func = self._callbacks.get(channel)
            if func:
                func(message['data'])
416488
def listen(self, callback=None, timeout=(5, 300)):
        """"""
        if self._running:
            return False
        # if self.devices() is False:
        #    return False
        self._queue = Queue()
        self._running = True
        self._timeout = timeout
        self._callback_listen = callback
        threading.Thread(target=self._thread_listen, args=()).start()
        threading.Thread(target=self._thread_worker, args=()).start()
        return True
650204
function listeners(type) {
      var object = this,
          events = object.events || (object.events = {});

      return _.has(events, type) ? events[type] : (events[type] = []);
    }
526499
def dispatchEvent(self, event, *args):
        
        for callback in self.listeners[event]:
            yield callback(event, self, *args)
603538
function (lstCfg, itfWrap) {
                for (var evt in lstCfg) {
                    if (lstCfg.hasOwnProperty(evt)) {
                        lstCfg[evt].listenOnce = true;
                    }
                }
                this.$addListeners(lstCfg, itfWrap);
            }
1267655
def enable_events(self, event_callback=None) -> None:
        """"""
        self.event = EventManager(event_callback)
        self.stream.event = self.event
241399
function addListener(event, callback, meta) {
  event.listeners.push(callback);
  event.meta.set(callback, meta);
}
271824
public function listen()
    {
        $this->listener_ = @stream_socket_server(
            $this->host_ . ':' . $this->port_,
            $errno,
            $errstr,
            STREAM_SERVER_BIND | STREAM_SERVER_LISTEN,
            $this->context_
        );
    }
347654
function listeners(type) {
    var me = this,
        events = me.events || (me.events = {});

    return hasKey(events, type) ? events[type] : (events[type] = []);
  }
23475
protected void listen() {
        if (!connectedFlag.get() || releaseNeeded.get()) {
            return;
        }

        releaseNeeded.set(true);
        try {
            send(pushListener, new OnFinishedHandler() {
                @Override
                public void onFinished() {
                    releaseNeeded.set(false);
                    listen();
                }
            });
        } catch (Exception e) {
            LOG.error("Error in sending long poll", e);
        }
    }
941395
function trigger(eventsInput, args)
  {
    try
    {
      var events = toArray( eventsInput, ' ' );

      for (var i = 0; i < events.length; i++)
      {
        triggerListeners( this.$$on, events[ i ], args );
      }
    }
    catch (ex)
    {
      Rekord.trigger( Rekord.Events.Error, [ex] );
    }

    return this;
  }
591591
def listen():
        """"""
        msg = MSG()
        ctypes.windll.user32.GetMessageA(ctypes.byref(msg), 0, 0, 0)
1168979
def emit(self, event, *event_args):
        
        listeners = self._listeners[event][:]
        for listener in listeners:
            args = list(event_args) + list(listener.user_args)
            result = listener.callback(*args)
            if result is False:
                self.off(event, listener.callback)
9363
def emit(self, event, *args, **kwargs):
        
        for func in self._registered_events[event].values():
            func(*args, **kwargs)
525758
function _addEvent(object, type, callback) {
        if (object.addEventListener) {
            object.addEventListener(type, callback, false);
            return;
        }

        object.attachEvent('on' + type, callback);
    }
73782
function (events, func) {
    for (var i = 0; i < events.length; i++) {
      obj.once(events[i], func)
      listeners[events[i]] = func
    }
  }
308305
def listen(self, once=False):
        

        if once:
            # we listen for time event and return false so our
            # run_queues function will be also falsy and break the loop
            self.add_listener("time", lambda _: False)
        return self.conn.listen()