Building Enterprise HTML5 Application

brite.dao.onDataChange

Triggered when a data change actions get resolved (e.g., create, delete, update, or any other method set as dataChange). Since, DAOs actions (i.e. create, update ...) are asynchronous, it is important to note that this callback will occur when the result is resolved (and not when the action on the dao is called)

brite.dao.onDataChange(callback,namespace)

Triggered on any entity types and any actions. See below for params definition.

brite.dao.onDataChange(entityTypes, callback, namespace)

Triggered on a specified list of entity types for any actions. See below for params definition.

brite.dao.onDataChange(entityTypes, actions,callback,namespace)

Examples

var namespace = "any-namespace";

// bind "create" and "update" actions on entity "User"
brite.dao.onDataChange("User","create,update",function(event){
  var daoEvent = event.daoEvent;
  console.log("action: " + daoEvent.action + " entityType: " + daoEvent.entityType + 
              " with result: ", daoEvent.result);
},namespace);

// bind any datachange events on entity of type "User"
brite.dao.onDataChange("User",function(){
   //...
},namespace);

// bind any datachange events on any entity types. 
brite.dao.onDataChange(function(){
  //...
},namespace);

Ask, learn, share about brite.js

Go to brite.js G+ community