PDA

View Full Version : Observe on what ?



realjax
21 Apr 2011, 2:00 AM
Hi,

I would like to put an Observable.observe() on *all* network data traffic in my app. What is the best way to go about? I've noticed that putting it on Ext.data.Connection doesn't cover a datastore's communication for instance..

Thanks in advance.

Stuart-SwarmOnline
21 Apr 2011, 7:36 AM
Ext.util.Observable.observeClass(Ext.data.Connection);
Ext.data.Connection.on('beforerequest', function(conn, options){
// do some stuff
});



That will cover all Ajax requests including stores.

Edit: just noticed the forum this is in! That code will work with ExtJS 3.x but not tried it on Sencha Touch - sorry if it's of no use!

realjax
21 Apr 2011, 11:16 PM
Thanks. I am aware that this works in Extjs. However, it seems things have changed considerably in Touch, where stores for instance no longer use Ext.data.Connection.

realjax
25 Apr 2011, 11:28 PM
bump