// ========================================================================== // 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) // ========================================================================== /** A RangeObserver is used by Arrays to automatically observe all of the objects in a particular range on the array. Whenever any property on one of those objects changes, it will notify its delegate. Likewise, whenever the contents of the array itself changes, it will notify its delegate and possibly update its own registration. This implementation uses only SC.Array methods. It can be used on any object that complies with SC.Array. You may, however, choose to subclass this object in a way that is more optimized for your particular design. */ SC.RangeObserver = { create: function(source, start, length, target, method) { var ret = SC.beget(this); ret.source = source; ret.start = start; ret.length = length; ret.target = target; ret.method = method; ret.observing = []; this.beginObserving(); return ret ; }, extend: function(attrs) { var ret = SC.beget(this), args = arguments, len = args.length, idx; for(idx=0;idx