Skip to content

Commit

Permalink
isKeyPath is also called a ridiculous amount of times on with the sam…
Browse files Browse the repository at this point in the history
…e args.. Such cache candidate
  • Loading branch information
stefanpenner committed Jul 30, 2014
1 parent 77adcc5 commit 66541fc
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/ember-metal/lib/watching.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ import {
} from "ember-metal/watch_path";

var metaFor = meta; // utils.js

// returns true if the passed path is just a keyName
function isKeyName(path) {
return path.indexOf('.') === -1;
}
import {
isPath
} from "ember-metal/path_cache";

/**
Starts watching a property on an object. Whenever the property changes,
Expand All @@ -45,7 +43,7 @@ function watch(obj, _keyPath, m) {
// can't watch length on Array - it is special...
if (_keyPath === 'length' && typeOf(obj) === 'array') { return; }

if (isKeyName(_keyPath)) {
if (!isPath(_keyPath)) {
watchKey(obj, _keyPath, m);
} else {
watchPath(obj, _keyPath, m);
Expand All @@ -65,7 +63,7 @@ export function unwatch(obj, _keyPath, m) {
// can't watch length on Array - it is special...
if (_keyPath === 'length' && typeOf(obj) === 'array') { return; }

if (isKeyName(_keyPath)) {
if (!isPath(_keyPath)) {
unwatchKey(obj, _keyPath, m);
} else {
unwatchPath(obj, _keyPath, m);
Expand Down

0 comments on commit 66541fc

Please sign in to comment.