|
From: Dan S. <dy...@fu...> - 2000-11-24 00:37:04
|
Just make your widget constructor call the DynLayer as a method:
function widget(arguments) {
this.DynLayer = DynLayer
this.Dynlayer(arguments)
}
widget.prototype = new DynLayer
Dan
On Fri, Nov 24, 2000 at 12:39:05AM +0100, Bartek wrote:
> I was wondering whether it is a good idea to have some inheritible constructor functionality for DynLayer.
> I want to be able to create a widget object that extends the DynLayer and inherits its initialization, i.e so I wouldn't have to rewrite the initialization code for the widget but instead do something like this:
>
> ------------------------------------------
>
> function WidgetLayer(){
> this.construct(arguments)
> }
> WidgetLayer.prototype=new DynLayer
>
> ------------------------------------------------------
>
> and it would look something like this for dynlayer:
>
> ---------------------------------------------------------------------
>
> function DynLayer(){ this.construct(arguments) }
> DynLayer.prototype.construct=function(){
> alert()
> var a=arguments
> if (a.length==1 && a[0]!=null && typeof(a[0])=="object") this.setStyle(a[0])
> else {
> this.id=a[0]||"JSDynLayer"+(DynLayer.nullCount++)
> this.x=a[1]||0
> .......etc...
> }
> }
>
> ---------------------------------------------------------------------------
>
> I am trying to implent this as I write, to test it out, and I'm having some problems.
> Maybe there is a better way of doing this... If so , please let me know. :)
> Or am I on the right track?
>
>
> /Bart
|