// ========================================================================== // Project: SproutCore Costello - Property Observing Library // Copyright: ©2006-2011 Strobe Inc. and contributors. // Portions ©2008-2010 Apple Inc. All rights reserved. // License: Licensed under MIT license (see license.js) // ========================================================================== // ........................................................................ // CHAIN OBSERVER // // This is a private class used by the observable mixin to support chained // properties. // ChainObservers are used to automatically monitor a property several // layers deep. // org.plan.name = SC._ChainObserver.create({ // target: this, property: 'org', // next: SC._ChainObserver.create({ // property: 'plan', // next: SC._ChainObserver.create({ // property: 'name', func: myFunc // }) // }) // }) // SC._ChainObserver = function(property, root) { this.property = property ; this.root = root || this ; } ; // This is the primary entry point. Configures the chain. SC._ChainObserver.createChain = function(rootObject, path, target, method, context) { // First we create the chain. var parts = path.split('.'), root = new SC._ChainObserver(parts[0]), tail = root; for(var i=1, l=parts.length; i