Sha256: 0486dd4038ebd6192ab7041412cb27286d8f232b7f99fa98a227ff1d54696b0f
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
/** @module ember */ import { peekMeta } from 'ember-meta'; import { isPath } from './path_cache'; import { unwatchKey, watchKey } from './watch_key'; import { unwatchPath, watchPath } from './watch_path'; /** Starts watching a property on an object. Whenever the property changes, invokes `Ember.notifyPropertyChange`. This is the primitive used by observers and dependent keys; usually you will never call this method directly but instead use higher level methods like `addObserver()`. @private @method watch @for Ember @param obj @param {String} keyPath @param {Object} meta */ export function watch(obj, keyPath, meta) { if (isPath(keyPath)) { watchPath(obj, keyPath, meta); } else { watchKey(obj, keyPath, meta); } } export function isWatching(obj, key) { return watcherCount(obj, key) > 0; } export function watcherCount(obj, key) { let meta = peekMeta(obj); return (meta !== undefined && meta.peekWatching(key)) || 0; } /** Stops watching a property on an object. Usually you will never call this method directly but instead use higher level methods like `removeObserver()`. @private @method unwatch @for Ember @param obj @param {String} keyPath @param {Object} meta */ export function unwatch(obj, keyPath, meta) { if (isPath(keyPath)) { unwatchPath(obj, keyPath, meta); } else { unwatchKey(obj, keyPath, meta); } }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.5.1.1 | dist/es/ember-metal/lib/watching.js |
discourse-ember-source-3.5.1.0 | dist/dist/es/ember-metal/lib/watching.js |