PDA

View Full Version : Module/singleton pattern vs. inheritance



snirf
31 Aug 2007, 12:03 AM
Hey,
I have a problem combining module pattern with class inheritance. What I would like is to have a module class giving me advantages of private and public variables/functions like this:


var Module = function() {
var privateVariable;
function privateMethod() {
...
}
return {
publicMethod : function() {
...
}
}
}();


But I would also like it to extend some other class (with Ext.extend). I can't figure out a way to do this. Is there one?

evant
31 Aug 2007, 12:08 AM
http://extjs.com/forum/showthread.php?t=6862&highlight=singleton