Lisenter
 this will be called from core, when the lisenter.listen is executed by user
772246
function Listener() {
		// setup abstract layer
		core.ListenerAbstract.apply(this, arguments);

		var self = this;

		// in case the process die, the connection will be severed
		this.object.on('exit', function () {
			if (self.online === true) {
				this.emit('close');
			}
		});

		process.nextTick(function () {
			// setup a new connection with the object
			self.emit('listening');

			// setup a new connection with the object
			self.emit('connection', self.object);
		});
	}
272053
public void addListener(IsSimplePromiseResponseHandler<T> listener) {
    if (handlers == null) {
      handlers = new LinkedList<>();
    }

    handlers.add(listener);

    if (response != null || exception != null) {
      listener.onResponse(this);
    }
  }
768816
function listen(listener) {
      // Copy of last location.
      var lastPublishedLocation = getLocationInStore(true);

      // Keep track of whether we unsubscribed, as Redux store
      // only applies changes in subscriptions on next dispatch
      var unsubscribed = false;
      var unsubscribeFromStore = store.subscribe(function () {
        var currentLocation = getLocationInStore(true);
        if (currentLocation === lastPublishedLocation) {
          return;
        }
        lastPublishedLocation = currentLocation;
        if (!unsubscribed) {
          listener(lastPublishedLocation);
        }
      });

      // History 2.x listeners expect a synchronous call. Make the first call to the
      // listener after subscribing to the store, in case the listener causes a
      // location change (e.g. when it redirects)
      if (!history.getCurrentLocation) {
        listener(lastPublishedLocation);
      }

      // Let user unsubscribe later
      return function () {
        unsubscribed = true;
        unsubscribeFromStore();
      };
    }
996457
function onListening() {
    var addr = server.address();
    var bind = typeof addr === 'string'
        ? 'pipe ' + addr
        : 'port ' + addr.port;
    console.error('Listening on ' + bind);
}
774092
@Override
    public synchronized void onOpen() {
        super.onOpen();

        if (phoneStateListener == null) {
            Handler mainHandler = new Handler(context.getMainLooper());
            mainHandler.post(new Runnable() {
                @Override
                public void run() {
                    phoneStateListener = new PhoneStateListener() {

                        @Override
                        public void onCellInfoChanged(List<CellInfo> cellInfo) {
                            if (cellInfo != null && !cellInfo.isEmpty()) {
                                onCellsChanged(cellInfo);
                            } else if (supportsCellInfoChanged) {
                                supportsCellInfoChanged = false;
                                onSignalStrengthsChanged(null);
                            }
                        }

                        @Override
                        public void onSignalStrengthsChanged(SignalStrength signalStrength) {
                            if (!supportsCellInfoChanged) {
                                fallbackScan();
                            }
                        }
                    };
                    registerPhoneStateListener();
                }
            });
        } else {
            registerPhoneStateListener();
        }
    }
164382
private function listEndHandler(): void
    {
        $this->process_repeats--;
        if ($this->process_repeats > 0) {
            return;
        }

        // Check if there is any list
        if (count($this->list) > 0) {
            $lineoffset = 0;
            foreach ($this->repeats_stack as $rep) {
                $lineoffset += $rep[1];
            }
            //-- read the xml from the file
            $lines = file($this->report);
            while ((strpos($lines[$lineoffset + $this->repeat_bytes], '<List') === false) && (($lineoffset + $this->repeat_bytes) > 0)) {
                $lineoffset--;
            }
            $lineoffset++;
            $reportxml = "<tempdoc>\n";
            $line_nr   = $lineoffset + $this->repeat_bytes;
            // List Level counter
            $count = 1;
            while (0 < $count) {
                if (strpos($lines[$line_nr], '<List') !== false) {
                    $count++;
                } elseif (strpos($lines[$line_nr], '</List') !== false) {
                    $count--;
                }
                if (0 < $count) {
                    $reportxml .= $lines[$line_nr];
                }
                $line_nr++;
            }
            // No need to drag this
            unset($lines);
            $reportxml .= '</tempdoc>';
            // Save original values
            $this->parser_stack[] = $this->parser;
            $oldgedrec            = $this->gedrec;

            $this->list_total   = count($this->list);
            $this->list_private = 0;
            foreach ($this->list as $record) {
                if ($record->canShow()) {
                    $this->gedrec = $record->privatizeGedcom(Auth::accessLevel($record->tree()));
                    //-- start the sax parser
                    $repeat_parser = xml_parser_create();
                    $this->parser  = $repeat_parser;
                    xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false);

                    xml_set_element_handler(
                        $repeat_parser,
                        function ($parser, string $name, array $attrs): void {
                            $this->startElement($parser, $name, $attrs);
                        },
                        function ($parser, string $name): void {
                            $this->endElement($parser, $name);
                        }
                    );

                    xml_set_character_data_handler(
                        $repeat_parser,
                        function ($parser, string $data): void {
                            $this->characterData($parser, $data);
                        }
                    );

                    if (!xml_parse($repeat_parser, $reportxml, true)) {
                        throw new DomainException(sprintf(
                            'ListEHandler XML error: %s at line %d',
                            xml_error_string(xml_get_error_code($repeat_parser)),
                            xml_get_current_line_number($repeat_parser)
                        ));
                    }
                    xml_parser_free($repeat_parser);
                } else {
                    $this->list_private++;
                }
            }
            $this->list   = [];
            $this->parser = array_pop($this->parser_stack);
            $this->gedrec = $oldgedrec;
        }
        [$this->repeats, $this->repeat_bytes] = array_pop($this->repeats_stack);
    }
8701
def listen(self):
        """"""
        while True:
            message = self.pull.recv()
            logger.debug("received message of length %d" % len(message))
            uuid, message = message[:32], message[32:]
            response = uuid + self.handle(message)
            self.push.send(response)
1223182
function listen(query,key,func)
    {
      /* standard message listener */
      if(arguments.length === 2)
      {
        func = key.bind(this);
        key = query;
        if(!_messages[key]) _messages[key] = [];
        _messages[key].push(func);
      }
      else
      {
        func = func.bind(this);
        if(!_scopemessages[query]) _scopemessages[query] = {};
        if(!_scopemessages[query][key]) _scopemessages[query][key] = [];
        _scopemessages[query][key].push(func);
        
        /* if this happens to be a parent component we immediately retrieve the value, if not then callAllSubscribers will fire initial */
        if(document.querySelector('.'+query))
        {
          var scopeMessages = _scopemessages[query][key],
              data = document.querySelector('.'+query).kb_mapper.kb_viewmodel,
              local = data.getLayer(key),
              localKey = key.split('.').pop(),
              val = local[localKey];
          scopeMessages[(scopeMessages.length-1)]({
            key:localKey,
            value:val,
            oldValue:val,
            local:local,
            kbref:data,
            onChange:false,
            initial:true
          });
        }
      }
      return this;
    }
1050097
def listen(self, listener):
        ''''''
        for message in listener.listen():
            try:
                data = json.loads(message['data'])
                if data['event'] in ('canceled', 'lock_lost', 'put'):
                    self.kill(data['jid'])
            except:
                logger.exception('Pubsub error')
601727
def listen(self):
        
        with Consumer(self.connection, queues=self.queue, on_message=self.on_message,
                      auto_declare=False):
            for _ in eventloop(self.connection, timeout=1, ignore_timeouts=True):
                    pass
576223
function () {
            /*  determine parameters  */
            var params = $cs.params("listen", arguments, {
                name:    { pos: 0,     req: true },
                ctx:     {             def: this },
                func:    { pos: 1,     req: true },
                args:    { pos: "...", def: []   },
                spec:    {             def: null } /* customized matching */
            });

            /*  attach listener information  */
            var id = _cs.cid();
            this.__listener[id] = params;
            return id;
        }
521100
def listen(url, prefix=None, **kwargs):
    
    return listener(url, prefix=get_prefix(prefix), **kwargs)
963122
def listen_to_event_updates():
    """"""
    def callback(event):
        print('Event:', event)

    client.create_event_subscription(instance='simulator', on_data=callback)

    sleep(5)
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);
        }
    }
140816
function onListening() {
    const addr = server.address();
    const bind = (typeof addr === 'string')
                ? 'pipe ' + addr
                : 'port ' + addr.port;
    debugServer('Listening on ' + bind);
  }
968373
function subscribe() {
    console.log(' > ', 'init', ['xmlrpc_bin://' + thisHost + ':2031', 'test123']);
    rpcClient.methodCall('init', ['xmlrpc_bin://' + thisHost + ':2031', 'test123'], function (err, res) {
        console.log(err, res);
    });
}
326439
public function listen() {
		$action = filter_input( INPUT_GET, 'action' );
		$nonce  = filter_input( INPUT_GET, 'nonce' );

		if ( $action === self::ACTION_NAME && wp_verify_nonce( $nonce, self::ACTION_NAME ) ) {
			$this->dismisser->dismiss();
		}
	}