PDA

View Full Version : extend Ext.data.Connection ?



dolittle
30 Nov 2009, 9:48 AM
Hi,

Why is Ext.data.Connection defined inside a singleton?
The beauty in ext is that you can extend stuff and now I can't.

Thanks

husniadil
30 Nov 2009, 10:37 AM
what singleton do you mean?

Ext.data.Connection is not singleton, but it's subclass Ext.Ajax is singleton...

-Object
--Ext.util.Observable (not singleton)
---Ext.data.Connection (not singleton)
----Ext.Ajax (singleton)

dolittle
30 Nov 2009, 10:57 AM
@husniadil

Did you look at the code?
Connect.js

(function(){
Ext.data.Connection = function(config){
...
});
})();

husniadil
30 Nov 2009, 11:14 AM
the file is Connection.js, not Connect.js

why does the documentation said that it's not a singleton?

Mike Robinson
1 Dec 2009, 7:49 AM
I don't find the word "singleton" occurring at all, anywhere on the documentation page.

As far as I can see, the real purpose of this object is so that you can "listen to it." It's an abstract class that defines common behaviors of all potential descendant classes. The documentation page shows in some detail the idea of listening to events thrown by its well-known descendent class, Ext.Ajax. The code that throws those events is located here in the base-class.

husniadil
1 Dec 2009, 1:08 PM
http://mashusni.co.cc/files/extjs/singleton.jpg