Hi. I'm trying to create a factory class for churning out objects. But
I'm running into some basic problem as illustrated here:
var FooFactory = Class.create();
FooFactory.items = new Hash();
FooFactory.get = function(id) {
this.items.get(id);
};
FooFactory.set = function(id, value) {
this.items.set(id, value);
};
FooFactory.test = function() {
console.log('Items:'+this.items.inspect());
};
If I run this, and execute in Firebug console, the "get" method
doesn't work:
>>> FooFactory.set('5','aaaa');
>>> FooFactory.test();
Items:#<Hash:{'5': 'aaaa'}>
>>> FooFactory.get('5').length;
TypeError: FooFactory.get("5") is undefined
Anyone have a tip? I can do FooFactory.items.get('5') just fine, but
would like to understand what I'm doing wrong.
Thanks,
Morten
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---