WinJS.Binding.bind function

Links the specified binding descriptor to the specified observable source object. When the properties of the observable object specified in the bindingDescriptor change, the corresponding functions are called.


var object = WinJS.Binding.bind(observable, bindingDescriptor);


  • observable
    Type: Object

    The object to bind to.

  • bindingDescriptor
    Type: Object

    An object literal containing the binding declarations. The binding declarations are in the form of an anonymous object, where the properties in the object match the name of the properties in the observable object to update.

Return value

Type: Object

An object that contains a cancel method that removes all bindings associated with this bind request.


In this example, a simple observable object is created and multiple bindings are added to the object in a single call to WinJS.Binding.bind.

var observedObject ={
    firstName: 'Mike',
    lastName: 'Stowe'

        firstName: function () { console.log("First name changed") },
        lastName: function () { console.log("Last name changed.") }

observedObject.firstName = "Bruce";
observedObject.lastName = "Keever";


Minimum WinJS version

WinJS 1.0