Martin Wittemann wrote:
Hi,
thats good to hear that the data binding layer helped you implementing
your qcl. Your proposal sound interesting. Do you think of something
like:
a.bind(b) === b.observe(a)
Greetings,
Martin
Am 10.07.2009 um 13:40 schrieb panyasan:
> And one proposal for the
> databinding API: it seems to make sense to me to add an observe()
> method
> that is the exact opposite of bind() just like in the qcl xml
> markup. It
> would be nothing but syntactic sugar but add readability to the
> qooxdoo
> code.
Yes, exactly. There is a technology in XUL that is related : broadcasters and observers
https://developer.mozilla.org/En/XUL_Tutorial/Broadcasters_and_Observersalthough the implementation differs from qcl.
The syntax could be
a.bind("property1",b,"property2") === b.observe("property2",a,"property1")
or one could even make the third argument optional if the properties are equal:
a.bind("enabled",b) === b.observe("enabled",a);
I find it a bit easier to read the code thinking along the lines of objects which "bind" other objects (active) and objects which "observe" other objects (passive).
Thanks, C.