Adds observers to the model for logging purposes.
764004
public static function bindEventsToModel(HalcyonModel $template)
    {
        $template->bindEvent('model.beforeDelete', function () use ($template) {
            self::add($template, self::TYPE_DELETE);
        });

        $template->bindEvent('model.beforeSave', function () use ($template) {
            self::add($template, $template->exists ? self::TYPE_UPDATE : self::TYPE_CREATE);
        });
    }
981318
def add_observer(self, observer):
        
        super(PowerManagement, self).add_observer(observer)
        if len(self._weak_observers) == 1:
            if not self._cf_run_loop:
                PowerManagement.notifications_observer.addObserver(self)
            else:
                @objc.callbackFor(IOPSNotificationCreateRunLoopSource)
                def on_power_sources_change(context):
                    self.on_power_source_notification()

                self._source = IOPSNotificationCreateRunLoopSource(on_power_sources_change, None)
                CFRunLoopAddSource(self._cf_run_loop, self._source, kCFRunLoopDefaultMode)
426588
def register(self, observers):
        

        if isinstance(observers, list) or isinstance(observers, tuple):

            for observer in observers:
                # check whether inhelitance "base.Observer"
                if isinstance(observer, base.Observer):
                    self._observers.append(observer)

                else:
                    raise InhelitanceError(base.Observer.__name__)

        elif isinstance(observers, base.Observer):
            self._observers.append(observers)
815994
boolean addObserver(ApptentiveNotificationObserver observer, boolean useWeakReference) {
		if (observer == null) {
			throw new IllegalArgumentException("Observer is null");
		}

		if (!contains(observer)) {
			observers.add(useWeakReference ? new ObserverWeakReference(observer) : observer);
			return true;
		}

		return false;
	}
114004
def add_watcher(self, fd, callback):
        """"""

        if not isinstance(fd, int):
            fd = fd.fileno()

        self.callbacks[fd] = callback
        self.epoll.register(fd, EPOLLIN)
159958
def notify(self, reading):
        """"""
        # copy list before iterating in case new observers arrive
        for o in list(self._observers):
            o.update(self, reading)
913672
@Deprecated
  public FluoConfiguration addObservers(Iterable<ObserverSpecification> observers) {
    int next = getNextObserverId();
    for (ObserverSpecification oconf : observers) {
      addObserver(oconf, next++);
    }
    return this;
  }
609195
def set_model(self, model):
        
        if self.model:
            self.model.unregister_observer(self)
        self.model = model
        if self.model:
            self.model.register_observer(self)
            self.model_notification()
        else:
            self.set_widget(None)
        self.widget.set_sensitive(bool(self.model))
763452
def on_remove(self, callable_):
        
        self.model.add_observer(
            callable_, self.entity_type, 'remove', self.entity_id)
688420
public void addObserver(IOutputStreamObserver obs)
	{
		if (obs==null){
			this.obs = obs;
		}
		else {
			if (obsList==null){
				this.obsList = new ArrayList <IOutputStreamObserver> ();
			}
			this.obsList.add(obs);
		}
	}
1003854
def _notify_add(self, slice_):
        """"""
        change = AddChange(self, slice_)
        self.notify_observers(change)
572980
@Override
    public void addObserver(final Observer<S, T> observer) {
        synchronized (OBSERVER_LOCK) {
            if (observers.contains(observer)) {
                LOGGER.warn("Skip observer registration. Observer[" + observer + "] is already registered!");
                return;
            }
            observers.add(observer);
        }
    }
272568
function Observer(obj, keypath, callback, options) {
    this.options = options || {}
    this.options.adapters = this.options.adapters || {}
    this.obj = obj
    this.keypath = keypath
    this.callback = callback
    this.objectPath = []
    this.update = this.update.bind(this)
    this.parse()

    if (isObject(this.target = this.realize())) {
      this.set(true, this.key, this.target, this.callback)
    }
  }
1089086
function() {
    this._observers.enabled = true;
    this._observers.forEach(this.observersBindHelper.bind(this), this);

    // Set namespaced hashes to the same value
    this._namespaces.forEach(this.observersStartHelper.bind(this), this);
  }
731968
protected void addServerEventHandlers() {
		Map<Object, Class<?>> handlers =  getServerEventHandlers();
		Set<Entry<Object, Class<?>>> entries = handlers.entrySet();
		for(Entry<Object, Class<?>> entry : entries) {
			SFSEventType type = SFSEventType.valueOf(
					entry.getKey().toString());
			ServerEventHandler handler = createServerEventHandler(
					type, entry.getValue());
			addEventHandler(type, handler);
		}
	}
472806
public void addWatcher(final MongoNamespace namespace,
                                     final Callback<ChangeEvent<BsonDocument>, Object> watcher) {
    instanceChangeStreamListener.addWatcher(namespace, watcher);
  }
882862
def add_observer(observer_class, func = :handle_event)
      func = func.to_sym

      unless observer_class.instance_methods.include?(func)
        m = "#<#{observer_class}> does not respond to `#{func}'"
        raise NoMethodError, m
      end

      observer_peers[observer_class] = func

      self
    end