1 // ========================================================================== 2 // Project: SproutCore Costello - Property Observing Library 3 // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 // Portions ©2008-2011 Apple Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 /** @namespace 9 The `SC.ObservableProtocol` protocol defines the properties and methods that you may implement 10 in your `SC.Observable` consumers (i.e. `SC.Object`) in order to access additional observer 11 functionality. They will be used if defined but are not required for observing to work. 12 13 *Note: Do not mix `SC.ObservableProtocol` into your classes. As a protocol, it exists only for 14 reference sake. You only need define any of the properties or methods listed below in order to use 15 this protocol.* 16 */ 17 SC.ObservableProtocol = { 18 19 /** 20 Generic property observer called whenever a property on the receiver changes. 21 22 If you need to observe a large number of properties on your object, it 23 is sometimes more efficient to implement this observer only and then to 24 handle requests yourself. Although this observer will be triggered 25 more often than an observer registered on a specific property, it also 26 does not need to be registered which can make it faster to setup your 27 object instance. 28 29 You will often implement this observer using a switch statement on the 30 key parameter, taking appropriate action. 31 32 @param observer {null} no longer used; usually null 33 @param target {Object} the target of the change. usually this 34 @param key {String} the name of the property that changed 35 @param value {Object} the new value of the property. 36 @param revision {Number} a revision you can use to quickly detect changes. 37 @returns {void} 38 */ 39 propertyObserver: function(observer,target,key,value, revision) { 40 41 } 42 43 }; 44