Sha256: 731c932178fe31d4fe7fe5a8aa9e8d083e3bac7b1d391d3b54efeb913ff263f3

Contents?: true

Size: 831 Bytes

Versions: 3

Compression:

Stored size: 831 Bytes

Contents

import changeEvent from './change_event';
import { addListener, removeListener } from './events';
import { unwatch, watch } from './watching';
/**
@module @ember/object
*/
/**
  @method addObserver
  @static
  @for @ember/object/observers
  @param obj
  @param {String} path
  @param {Object|Function} target
  @param {Function|String} [method]
  @public
*/
export function addObserver(obj, path, target, method) {
    addListener(obj, changeEvent(path), target, method);
    watch(obj, path);
}
/**
  @method removeObserver
  @static
  @for @ember/object/observers
  @param obj
  @param {String} path
  @param {Object|Function} target
  @param {Function|String} [method]
  @public
*/
export function removeObserver(obj, path, target, method) {
    unwatch(obj, path);
    removeListener(obj, changeEvent(path), target, method);
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/metal/lib/observer.js
discourse-ember-source-3.5.1.1 dist/es/ember-metal/lib/observer.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-metal/lib/observer.js