Binds the values of an object to the values of a DOM element that has the data-win-bind attribute. If multiple DOM elements are to be bound, you must set the attribute on all of them. YSee the example below for details.
Note If a control itself contains controls, and the parent control does the processing on its child controls. <control>.constructor.isDeclarativeControlContainer is true, and this method does not process the child controls, if <control>.constructor.isDeclarativeControlContainer is false, this method processes the child controls.
Syntax
WinJS.Binding.processAll(rootElement, dataContext, skipRoot, bindingCache).done( /* Your success and error handlers */ );
Parameters
- rootElement
-
Type: DOMElement
Optional. The element at which to start traversing to find elements to bind to. If this parameter is omitted, the entire document is searched.
- dataContext
-
Type: Object
The object that contains the values to which the DOM element should be bound.
- skipRoot
-
Type: Boolean
If true, specifies that only the children of rootElement should be bound, otherwise rootElement should be bound as well.
- bindingCache
-
Type: Object
The cached binding data.
Return value
Type: Promise
A Promise that completes when every item that contains the data-win-bind attribute has been processed and the update has started.
Examples
The following code shows how to use the processAll function to bind a DIV element to a person custom object. The person.age property changes every 500 milliseconds.
<div id="boundDiv" data-win-bind="innerText: age"></div> <script type="text/javascript"> var person = { age: 0 }; var span = document.getElementById("boundSpan"); WinJS.Binding.processAll(span, person); var bindingPerson = WinJS.Binding.as(person); setInterval(function () { changeAge(bindingPerson); }, 500); function changeAge(p) { p.age++; }; </script>
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
WinJS.Binding |
|
Library |
|
Build date: 12/5/2012