Building Enterprise HTML5 Application

brite.dao.off*

brite.dao.offResult(namespace)

Unbind all "onResult" binding for this given namespace.

brite.dao.offDataChange(namespace)

Unbind all "onDataChange" binding for this given namespace.

brite.dao.offAny(namespace)

Unbind all "onResult" and "onDataChange" binding for this given namespace.

Examples

// To completely unbind dao event for "someNamespace"

// Option 1: unbind each type  
brite.dao.offResult("someNamespace");
brite.dao.offDataChange("someNamespace");


// Option 2: unbind all 
// (just a shortcut to option 1)
brite.dao.offAny("someNamespace");

Note: View auto unbinding

Views' daoEvents get automatically namespace with the view.id, and brite automatically unbind any dao binding the view.id namespace when the view get discarded. Consequently, no need to implement the .destroy to unbind these dao bindings (as long as they follow one of these two ways).

// Best-Practice: When in some view logic, 
// it is good to use view.id as a namespace
// it will get automatically unbound on view destroy
brite.registerView("MyView",{
  create: ...,
  
  postDisplay: function(){
    var view = this;
    brite.dao.onResult("Task",function(){...},view.id);
  },
  
  daoEvents: {
    "dataChange; Project": ....
  }
}

// No need to implement MyView.destroy to unbind these
// dao bindngs. 

Ask, learn, share about brite.js

Go to brite.js G+ community