Back from the green pit, and upgrading to the latest version.
I'm porting my widget set to the latest version ( finally ) and, while
trying to have several inheritance levels (DynLayer->W1-W2) , I have
discovered some issues I find relevant. I understand this can be seen as a
secondary problem but here it goes:
- We want to have widgets inherit from widgets. So, we create a widget
called A and write
function A()
{
this.DynLayer = DynLayer
this.DynLayer()
blablabla
eventlistener
oncreate() Init stuff
addEventListener
}
A.prototype = new DynLayer
MEthods...
Widget A works perfectly. Then we want a more complicated widget B that
extends widget A.
function B()
{
this.A = A
this.A()
blablabla
more blablabla
eventlistener
oncreate() more Init stuff
addEventListener
}
B.prototype = new A
We do the test and everything seems OK. But then if we try having two or
more instances of B, events go crazy.
Finally I have realized that when we do B.prototype = new A, the code inside
As constructor adds an event listener to
the object (the oncreate one) thus defining the eventListener array and the
hasListeners variable.
Therefore all the instances of B will share both the value and the array. No
need to tell what this can cause. I'm working on
this and hopefully will post some workaround ( I'm not sure this is a bug in
the API ). I could have A's constructor to reassign the eventListener
array and the boolean value, but then the onCreate() of B would never be
executed.... Aaarggg !!!!
I'll deal with the problem myself, but any advice is appreciated.
I'm happy to see people finding bugs in the API, it means that the old ones
have been fixed :)
|