look up all ApiBuilder listeners then add it to api
197130
function mergeListeners(emitter) {
      var events = emitter._events;
      _.each(events, function (fns, type) {
        if (Array.isArray(fns)) {
          _.each(fns, function (fn) {
            if (_.isFunction(fn)) {
              self.on(type, fn);
            }
          });
        } else if (_.isFunction(fns)) {
          self.on(type, fns);
        }
      });
    }
138400
private void executeListeners() {
    if (!monitor.isOccupiedByCurrentThread()) {
      // iterate by index to avoid concurrent modification exceptions
      for (int i = 0; i < listeners.size(); i++) {
        listeners.get(i).execute();
      }
    }
  }
318853
function addHookFn (proto, name) {
  proto[name] = function () {
    var args = [].splice.call(arguments, 0);

    var fn = args.splice(args.length - 1)[0];
    fn = _.isFunction(fn) ? fn : undefined;

    var options = {};
    if (_.isPlainObject(args[args.length - 1])) {
      options = args.splice(args.length - 1)[0];
    }

    var self = this;
    _.each(args, function(arg) {
      var event = util.format('%s.%s.%s.%s', name, self.name, self.version, arg);
      // remove old listeners if redefine is true
      if (options.redefine) {
        debug('Redefine hook', event);
        self.removeAllListeners(event);
      }
      self.on(event, fn);
    });
  };
}
947806
def add_listener(registry, listener):
    
    if listener is None or listener in registry:
        return False

    registry.append(listener)
    return True
530488
function addListener(obj, eventName, target, method) {
  Ember.assert("You must pass at least an object and event name to Ember.addListener", !!obj && !!eventName);

  if (!method && 'function' === typeof target) {
    method = target;
    target = null;
  }

  var actionSet = actionSetFor(obj, eventName, target, true),
      methodGuid = guidFor(method);

  if (!actionSet[methodGuid]) {
    actionSet[methodGuid] = { target: target, method: method };
  }

  if ('function' === typeof obj.didAddListener) {
    obj.didAddListener(eventName, target, method);
  }
}
418182
public RetryTemplateBuilder withListeners(List<RetryListener> listeners) {
		for (final RetryListener listener : listeners) {
			Assert.notNull(listener, "Listener should not be null");
		}
		listenersList().addAll(listeners);
		return this;
	}
414658
private void trackListeners(final BundleContext bundleContext) {
		final ServiceTracker<EventListener, ListenerWebElement> listenerTracker = ListenerTracker
				.createTracker(extenderContext, bundleContext);

		listenerTracker.open();
		trackers.add(0, listenerTracker);

		// FIXME needed?
		final ServiceTracker<ListenerMapping, ListenerMappingWebElement> listenerMappingTracker = ListenerMappingTracker
				.createTracker(extenderContext, bundleContext);

		listenerMappingTracker.open();
		trackers.add(0, listenerMappingTracker);
	}
1258221
function (callback) {
    var plugins = this.internals.plugins;
    var self = this;

    return Promise.resolve(Object.keys(APIHooks))
      .each(function (hook) {
        var plugin = plugins.hook(hook);
        if (!plugin) return;

        var APIHook = APIHooks[hook].bind(self);

        return Promise.resolve(plugin)
          .map(function (plugin) {
            return plugin[hook]();
          })
          .each(function (args) {
            return APIHook.apply(self, args);
          });
      })
      .asCallback(callback);
  }
1182419
public synchronized void addListener(CollectionProxyListener listener)
    {
        if (_listeners == null)
        {
            _listeners = new ArrayList();
        }
        // to avoid multi-add of same listener, do check
        if(!_listeners.contains(listener))
        {
            _listeners.add(listener);
        }
    }
115174
public void addListeners(PropertyChangeListener listener, Object newObject, Set updateSet) {
        removeListeners();
        if (newObject != null) {
            // check for local synthetics
            TriggerBinding syntheticTrigger = getSyntheticTriggerBinding(newObject);
            MetaClass mc = InvokerHelper.getMetaClass(newObject);
            if (syntheticTrigger != null) {
                PropertyBinding psb = new PropertyBinding(newObject, propertyName);
                PropertyChangeProxyTargetBinding proxytb = new PropertyChangeProxyTargetBinding(newObject, propertyName, listener);

                syntheticFullBinding = syntheticTrigger.createBinding(psb, proxytb);
                syntheticFullBinding.bind();
                updateSet.add(newObject);
            } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", NAME_PARAMS).isEmpty()) {
                InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", new Object[] {propertyName, listener});
                localListener = listener;
                updateSet.add(newObject);
            } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", GLOBAL_PARAMS).isEmpty()) {
                InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", listener);
                globalListener = listener;
                updateSet.add(newObject);
            }
        }
        currentObject = newObject;
    }
1012693
private void findListeners(BaseComponent cmpt) {
        for (BaseComponent child : cmpt.getChildren()) {
            tryRegisterListener(child, true);
            tryRegisterListener(FrameworkController.getController(child), true);
            findListeners(child);
        }
    }
93315
function addListener(name) {
  if (name !== 'collect') {
    return;
  }

  if (this._collecting) {
    // Don't add more than once
    return;
  }

  debug('adding collect method', this._readableState.objectMode, this._readableState.encoding);

  let collected;
  if (this._readableState.objectMode) {
    collected = [];
  } else if (this._readableState.encoding === null) {
    collected = Buffer.from('');
  } else {
    collected = '';
  }

  this
    .on('readable', () => {
      let chunk;
      while ((chunk = this.read()) !== null) {
        debug('data', chunk);

        if (chunk !== null) {
          if (this._readableState.objectMode) {
            collected.push(chunk);
          } else if (this._readableState.encoding === null) {
            collected = Buffer.concat([collected, chunk]);
          } else {
            collected += chunk;
          }
        }
      }
    })
    .on('end', () => this.emit('collect', collected));

  this._collecting = true;
}
403439
function listenCollection(collection, listener) {
    collection.forEach(function listenModel(model) {
        listen(model, listener);
    });

    collection.on('add', function onAdd(model) {
        listen(model, listener);
        listener();
    });
}
283083
@Override
	public void setBundlingProcessLifeCycleListeners(List<BundlingProcessLifeCycleListener> listeners) {
		this.lifeCycleListeners.clear();
		this.lifeCycleListeners.addAll(listeners);
	}
744803
public void addListeners()
    {
        super.addListeners();
        this.getMainRecord().getField(Registration.RESOURCE_ID).addListener(new ReadSecondaryHandler(this.getRecord(Resource.RESOURCE_FILE)));
    }
722792
def _get_listeners(instance, change):
    """"""
    if (
            change['mode'] not in listeners_disabled._quarantine and           #pylint: disable=protected-access
            change['name'] in instance._listeners
    ):
        return instance._listeners[change['name']][change['mode']]
    return []
1260764
def list_listeners(self, retrieve_all=True, **_params):
        """"""
        return self.list('listeners', self.lbaas_listeners_path,
                         retrieve_all, **_params)