On Fri, Apr 17, 2009 at 6:36 PM, P T Withington <[email protected]> wrote:

> I'm working on http://jira.openlaszlo.org/jira/browse/LPP-8058 to reduce
> the number of extraneous events sent by implementing the following
> optimization:
>
> If an attribute is constrained, and the values the constraint depends on
> change, but the result of the constraint does _not_ change, then the
> attribute will not be updated (to the identical value) and, more
> importantly, no `on` event will be sent.  The change can be demonstrated by
> considering the following:
>
> <canvas layout="axis: x; spacing: 5" debug="true">
>    <attribute name="jay" value="2" />
>    <handler name="onjay">Debug.info("onjay")</handler>
>    <attribute name="kay" value="4" />
>    <handler name="onkay">Debug.info("onkay")</handler>
>    <attribute name="jaykay" value="${jay*kay}" />
>    <handler name="onjaykay">
>       Debug.info("onjaykay: %d * %d = %d", jay, kay, jaykay);
>    </handler>
>    <button onclick="canvas.setAttribute('jay', canvas.jay)">Same</button>
>    <button onclick="canvas.setAttribute('jay', canvas.jay +
> 1)">Different</button>
> </canvas>
>
> In the current system, setting `jay` will _always_ cause `jaykay` to be
> updated, and for there to be an `onjaykay` event.  In the proposed change,
> setting `jay` to the same value, will cause an `onjay` event, but the
> constraint on `jaykay` will have the same result, so `jaykay` will _not_ be
> updated and there will be _no_ `onjaykay` event sent.
>
> Comments?  Questions?
>

I use handlers to fire functionality without actually changing any values.
An example would be

<canvas>
    <attribute name="update" type="boolean" value="false"/>
    <...>
       <handler name="onupdate" reference="canvas">
           //do something
       </handler>
    </...>
<canvas>

<method name="update">
   canvas.setAttribute('update', true);
</method>
where i expect the update handlers to get run on true regardless of whether
they were already true before. This change would require that i set update
to false after such an event. In my own runtime, i include a "touch" method
which allows me to fire an event without having to set an explicit value,
just for these type of delegate networks. I would toss in my two cents by
saying that it would be nice to have one or the other available to me.

there might be other methods to accomplish the same thing - i'm just
pointing out a pattern that my code depends on, currently

-james

Reply via email to