proxy.faye¶
webix.proxy.
faye
¶webix.proxy.faye helper.
Please look into the linked official documentation.
External references¶
Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | webix.proxy.faye = {
$proxy:true,
init:function(){
this.clientId = this.clientId || webix.uid();
},
load:function(view){
var selfid = this.clientId;
this.client.subscribe(this.source, function(update){
if (update.clientId == selfid) return;
webix.dp(view).ignore(function(){
if (update.operation == "delete")
view.remove(update.data.id);
else if (update.operation == "insert")
view.add(update.data);
else if (update.operation == "update"){
var item = view.getItem(update.data.id);
if (item){
webix.extend(item, update.data, true);
view.refresh(item.id);
}
}
});
});
},
save:function(view, update, dp, callback){
update.clientId = this.clientId;
this.client.publish(this.source, update);
}
};
//indexdb->database/collection
|