From 4cb94d74132dfc6959bc23bbe2fae5d46e1a248a Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Tue, 14 Oct 2014 22:39:53 -0400 Subject: [PATCH] remove rewatch --- packages/ember-metal/lib/watching.js | 28 +------------------ .../ember-metal/tests/binding/connect_test.js | 27 ------------------ .../ember-metal/tests/utils/guidFor_test.js | 17 ----------- .../ember-runtime/lib/system/core_object.js | 2 -- 4 files changed, 1 insertion(+), 73 deletions(-) diff --git a/packages/ember-metal/lib/watching.js b/packages/ember-metal/lib/watching.js index e16ceaa6f3f..2917b756d3c 100644 --- a/packages/ember-metal/lib/watching.js +++ b/packages/ember-metal/lib/watching.js @@ -3,9 +3,7 @@ */ import { - GUID_KEY, - typeOf, - generateGuid + typeOf } from "ember-metal/utils"; import { removeChainWatcher, @@ -68,30 +66,6 @@ export function unwatch(obj, _keyPath, m) { } } -/** - Call on an object when you first beget it from another object. This will - setup any chained watchers on the object instance as needed. This method is - safe to call multiple times. - - @private - @method rewatch - @for Ember - @param obj -*/ -export function rewatch(obj) { - var m = obj['__ember_meta__'], chains = m && m.chains; - - // make sure the object has its own guid. - if (GUID_KEY in obj && !obj.hasOwnProperty(GUID_KEY)) { - generateGuid(obj); - } - - // make sure any chained watchers update. - if (chains && chains.value() !== obj) { - m.chains = chains.copy(obj); - } -} - var NODE_STACK = []; /** diff --git a/packages/ember-metal/tests/binding/connect_test.js b/packages/ember-metal/tests/binding/connect_test.js index 11e3175641f..e9b79c03282 100644 --- a/packages/ember-metal/tests/binding/connect_test.js +++ b/packages/ember-metal/tests/binding/connect_test.js @@ -5,10 +5,8 @@ import { bind } from "ember-metal/binding"; import run from 'ember-metal/run_loop'; -import { create } from 'ember-metal/platform'; import { set } from 'ember-metal/property_set'; import { get } from 'ember-metal/property_get'; -import { rewatch } from "ember-metal/watching"; function performTest(binding, a, b, get, set, connect) { if (connect === undefined) connect = function() {binding.connect(a);}; @@ -104,31 +102,6 @@ testBoth('Calling connect more than once', function(get, set) { }); }); -testBoth('Bindings should be inherited', function(get, set) { - - var a = { foo: 'FOO', b: { bar: 'BAR' } }; - var binding = new Binding('foo', 'b.bar'); - var a2; - - run(function () { - binding.connect(a); - - a2 = create(a); - rewatch(a2); - }); - - equal(get(a2, 'foo'), "BAR", "Should have synced binding on child"); - equal(get(a, 'foo'), "BAR", "Should NOT have synced binding on parent"); - - run(function () { - set(a2, 'b', { bar: 'BAZZ' }); - }); - - equal(get(a2, 'foo'), "BAZZ", "Should have synced binding on child"); - equal(get(a, 'foo'), "BAR", "Should NOT have synced binding on parent"); - -}); - test('inherited bindings should sync on create', function() { var a; run(function () { diff --git a/packages/ember-metal/tests/utils/guidFor_test.js b/packages/ember-metal/tests/utils/guidFor_test.js index 469e3b5317e..c2ba991b9a6 100644 --- a/packages/ember-metal/tests/utils/guidFor_test.js +++ b/packages/ember-metal/tests/utils/guidFor_test.js @@ -1,7 +1,6 @@ import { guidFor } from "ember-metal/utils"; -import { rewatch } from "ember-metal/watching"; QUnit.module("guidFor"); @@ -27,22 +26,6 @@ test("Object", function() { nanGuid( a ); }); -test("Object with prototype", function() { - var Class = function() { }; - - guidFor(Class.prototype); - - var a = new Class(); - var b = new Class(); - - sameGuid( a, b , "without calling rewatch, objects copy the guid from their prototype"); - - rewatch(a); - rewatch(b); - - diffGuid( a, b, "after calling rewatch, objects don't share guids" ); -}); - test("strings", function() { var a = "string A"; var aprime = "string A"; diff --git a/packages/ember-runtime/lib/system/core_object.js b/packages/ember-runtime/lib/system/core_object.js index c565317359a..6dd670f46d0 100644 --- a/packages/ember-runtime/lib/system/core_object.js +++ b/packages/ember-runtime/lib/system/core_object.js @@ -20,7 +20,6 @@ import { meta, makeArray } from "ember-metal/utils"; -import { rewatch } from "ember-metal/watching"; import { finishChains } from "ember-metal/chains"; import { sendEvent } from "ember-metal/events"; import { @@ -196,7 +195,6 @@ function makeCtor() { if (!wasApplied) { wasApplied = true; Class.PrototypeMixin.applyPartial(Class.prototype); - rewatch(Class.prototype); } return this.prototype;