// ========================================================================== // Project: SproutCore Costello - Property Observing Library // Copyright: ©2006-2009 Sprout Systems, Inc. and contributors. // Portions ©2008-2009 Apple, Inc. All rights reserved. // License: Licened under MIT license (see license.js) // ========================================================================== require('system/object'); // ........................................................................ // 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) { this.property = property ; } ; // 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, len = parts.length; for(var idx=1;idx