Condividi tramite


WinJS.Binding.processAll function

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. See 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, defaultInitializer).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. One-time binding is used when this parameter is the window object or a Windows Runtime object.

    Note  It is not advisable to pass the window object as processAll'sdataContext. Instead, it is better practice to create a separate object and pass that to the dataContext.

     

  • 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.

  • defaultInitializer
    Type: Function

    The binding initializer to use in the case that one is not specified in a binding expression. If not provided, the behavior is the same as Binding.defaultBind.

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.

Remarks

It's best not to pass the window object as processAll's dataContext. Instead, create your own dataContext object.

When using data binding, your data context should:

  • Only contain data (i.e. no functions)
  • Not contain any non-extensible objects

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Binding