I use to extend class with static members but in a resul I extend
clsses every time with the same module - but I neet the very time the
new copy of it
I need that every class could trace theirs instances
var module = (function(){
var instances = [], pubs = {};
pubs.addInstance = addInstance;
function addInstance(inst){ instances.push(inst); }
pubs.removeInstance = removeInstance;
function removeInstance(inst){ instances =
$A(instances).without(inst); }
function getInstances() {return $A(instances); }
}());
var Class1 = Class.create({...}), Class2 = Class.create({...});
Object.extend(Class1, module); Object.extend(Class2, module)l
var c1 = new Class1, c2 = new Class2;
after creating c1 and c2 in Firebug we could see that every object
references the same module, so Class1 and Class2 have instances array
with two elements - but I need to have one
If I extend every Class not with module but with explicity defined
block - everythig works fine? but it's require typing the same every
time!
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.