blob: 497b8b7ab33c114591014a8b5e5c695397c081e4 [file] [log] [blame]
{ "type": "class",
"qname": "mx.binding.utils.ChangeWatcher",
"baseClassname": ""
,
"description": "The ChangeWatcher class defines utility methods that you can use with bindable Flex properties. These methods let you define an event handler that is executed whenever a bindable property is updated.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"members": [
{ "type": "method",
"qname": "watch",
"namespace": "public",
"bindable": [],
"details": ["static"],
"deprecated": {},
"description": "Creates and starts a ChangeWatcher instance. A single ChangeWatcher instance can watch one property, or a property chain. A property chain is a sequence of properties accessible from a host object. For example, the expression <code>obj.a.b.c</code> contains the property chain (a, b, c). to be watched. You can use the use the <code>reset()</code> method to change the value of the <code>host</code> argument after creating the ChangeWatcher instance. The <code>host</code> maintains a list of <code>handlers</code> to invoke when <code>prop</code> changes. Legal values are: <ul> <li>A String containing the name of a public bindable property of the host object.</li> <li>An Object in the form: <code>{ name: <i>property name</i>, getter: function(host) { return host[name] } }</code>. The Object contains the name of a public bindable property, and a function which serves as a getter for that property.</li> <li>A non-empty Array containing any combination of the first two options. This represents a chain of bindable properties accessible from the host. For example, to watch the property <code>host.a.b.c</code>, call the method as: <code>watch(host, [&quot;a&quot;,&quot;b&quot;,&quot;c&quot;], ...)</code>.</li> </ul> <p>Note: The property or properties named in the <code>chain</code> argument must be public, because the <code>describeType()</code> method suppresses all information about non-public properties, including the bindability metadata that ChangeWatcher scans to find the change events that are exposed for a given property. However, the getter function supplied when using the <code>{ name, getter }</code> argument form described above can be used to associate an arbitrary computed value with the named (public) property.</p> watched property (or any property in a watched chain) is modified. The modification is signaled when any host object in the watcher chain dispatches the event that has been specified in that host object's <code>[Bindable]</code> metadata tag for the corresponding watched property. The default event is named <code>propertyChange</code>. <p>The event object dispatched by the bindable property is passed to this handler function without modification. By default, Flex dispatches an event object of type PropertyChangeEvent. However, you can define your own event type when you use the <code>[Bindable]</code> metadata tag to define a bindable property.</p> called only on committing change events; set to <code>false</code> if the handler should be called on both committing and non-committing change events. Note: the presence of non-committing change events for a property is indicated by the <code>[NonCommittingChangeEvent(&lt;event-name&gt;)]</code> metadata tag. Typically these tags are used to indicate fine-grained value changes, such as modifications in a text field prior to confirmation. the reference to <code>handler</code> is strong or weak. A strong reference (the default) prevents <code>handler</code> from being garbage-collected. A weak reference does not. been specified to the <code>chain</code> argument; null otherwise. Note that the returned watcher is not guaranteed to have successfully discovered and attached itself to change events, since none may have been exposed on the given property or chain by the host. You can use the <code>isWatching()</code> method to determine the watcher's state.",
"tags": [
{ "tagName": "see",
"values": ["mx.events.PropertyChangeEvent"]},
{ "tagName": "param",
"values": ["host The object that hosts the property or property chain", "chain A value specifying the property or chain to be watched.", "handler An event handler function called when the value of the", "commitOnly Set to <code>true</code> if the handler should be", "useWeakReference (default = false) Determines whether"]},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "return",
"values": ["The ChangeWatcher instance, if at least one property name has"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "mx.binding.utils.ChangeWatcher",
"params": [{ "name": "host", "type": "Object"},
{ "name": "chain", "type": "Object"},
{ "name": "handler", "type": "Function"}]}
,
{ "type": "method",
"qname": "canWatch",
"namespace": "public",
"bindable": [],
"details": ["static"],
"deprecated": {},
"description": "Lets you determine if the host exposes a data-binding event on the property. <p>NOTE: Property chains are not supported by the <code>canWatch()</code> method. They are supported by the <code>watch()</code> method.</p> See the <code>watch()</code> method for more information. See the <code>watch()</code> method for more information. should be called only on committing change events. See the <code>watch()</code> method for more information. any change events on <code>name</code>.",
"tags": [
{ "tagName": "param",
"values": ["host The host of the property.", "name The name of the property.", "commitOnly Set to <code>true</code> if the handler"]},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "return",
"values": ["<code>true</code> if <code>host</code> exposes"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "Boolean",
"params": [{ "name": "host", "type": "Object"},
{ "name": "name", "type": "String"}]}
,
{ "type": "method",
"qname": "getEvents",
"namespace": "public",
"bindable": [],
"details": ["static"],
"deprecated": {},
"description": "Returns all binding events for a bindable property in the host object. See the <code>watch()</code> method for more information. See the <code>watch()</code> method for more information. change events in the returned value. containing all change events for the property.",
"tags": [
{ "tagName": "param",
"values": ["host The host of the property.", "name The name of the property, or property chain.", "commitOnly Controls inclusion of non-committing"]},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "return",
"values": ["Object of the form <code>{ eventName: isCommitting, ... }</code>"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "Object",
"params": [{ "name": "host", "type": "Object"},
{ "name": "name", "type": "String"}]}
,
{ "type": "method",
"qname": "mx.binding.utils.ChangeWatcher",
"namespace": "",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Constructor. Not for public use. This method is called only from the <code>watch()</code> method. See the <code>watch()</code> method for parameter usage.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "",
"params": [{ "name": "access", "type": "Object"},
{ "name": "handler", "type": "Function"},
{ "name": "next", "type": "mx.binding.utils.ChangeWatcher"}]}
,
{ "type": "method",
"qname": "unwatch",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Detaches this ChangeWatcher instance, and its handler function, from the current host. You can use the <code>reset()</code> method to reattach the ChangeWatcher instance, or watch the same property or chain on a different host object.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "void",
"params": []}
,
{ "type": "method",
"qname": "getValue",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Retrieves the current value of the watched property or property chain, or null if the host object is null. For example: <pre>\\n watch(obj, [&quot;a&quot;,&quot;b&quot;,&quot;c&quot;], ...).getValue() === obj.a.b.c\\n </pre>",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "return",
"values": ["The current value of the watched property or property chain."]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "Object",
"params": []}
,
{ "type": "method",
"qname": "setHandler",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Sets the handler function.",
"tags": [
{ "tagName": "param",
"values": ["handler The handler function. This argument must not be null."]},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "void",
"params": [{ "name": "handler", "type": "Function"}]}
,
{ "type": "method",
"qname": "isWatching",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Returns <code>true</code> if each watcher in the chain is attached to at least one change event. Note that the <code>isWatching()</code> method varies with host, since different hosts may expose different change events for the watcher's chosen property. to at least one change event.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "return",
"values": ["<code>true</code> if each watcher in the chain is attached"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "Boolean",
"params": []}
,
{ "type": "method",
"qname": "reset",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Resets this ChangeWatcher instance to use a new host object. You can call this method to reuse a watcher instance on a different host. See the <code>watch()</code> method for more information.",
"tags": [
{ "tagName": "param",
"values": ["newHost The new host of the property."]},
{ "tagName": "playerversion",
"values": ["Flash 9", "AIR 1.1"]},
{ "tagName": "productversion",
"values": ["Flex 3"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "void",
"params": [{ "name": "newHost", "type": "Object"}]}
]
}