Have you ever considered not including the initialize method in the
subclass?
Perhaps your baseclass can check if there's a child 'constructor' present
and automatically call that:
var MySuper = Class.create({
initialize: function() {
// do stuff
if (this.childConstructor) {
this.childConstructor();
}
}
});
var MySub = Class.create(MySuper, {
childConstructor: function() {
// stuff that only the child needs to do
// MySuper.initialize has already been called at this moment.
}
});
Ofcourse the naming can be different but it's just an idea.
On Tue, Jan 3, 2012 at 3:25 PM, buda <[email protected]> wrote:
> How to setup base class so that subclasses don't neet to call $super
> in their initialize method (because they might skip this call or call
> with wrong parameters) ?
>
> --
> 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.
>
>
--
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.