|
From: Bartek <ba...@ho...> - 2000-11-23 23:41:34
|
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=3Dnew DynLayer
------------------------------------------------------
and it would look something like this for dynlayer:
---------------------------------------------------------------------
function DynLayer(){ this.construct(arguments) }
DynLayer.prototype.construct=3Dfunction(){
alert()
var a=3Darguments
if (a.length=3D=3D1 && a[0]!=3Dnull && typeof(a[0])=3D=3D"object") =
this.setStyle(a[0])
else {
this.id=3Da[0]||"JSDynLayer"+(DynLayer.nullCount++)
this.x=3Da[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
|