<br>It seems to me that in your example, you really want to send an event, and setting the attribute is one step removed from that. So maybe the most<div>clear way to implement that would be to call sendEvent directly</div>
<div><br></div><div><br></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-size: 26px; "><div class="gmail_quote"><div><span class="Apple-style-span" style="font-size: small;">&lt;method name=&quot;update&quot;&gt;</span></div>
<div><span class="Apple-style-span" style="font-size: small;">   canvas.onupdate.sendEvent( true);</span></div></div><span class="Apple-style-span" style="font-size: small;">&lt;/method&gt;</span></span><span class="Apple-style-span" style="font-size: small;"><br>
</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-size: 37px;"><br></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-size: 53px;"><br></span></div>
<div><br></div><div><br><div class="gmail_quote">On Sat, Apr 25, 2009 at 6:46 PM, jamesr <span dir="ltr">&lt;<a href="mailto:circlecycle@gmail.com">circlecycle@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Fri, Apr 17, 2009 at 6:36 PM, P T Withington <span dir="ltr">&lt;<a href="mailto:ptw@pobox.com" target="_blank">ptw@pobox.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I&#39;m working on <a href="http://jira.openlaszlo.org/jira/browse/LPP-8058" target="_blank">http://jira.openlaszlo.org/jira/browse/LPP-8058</a> to reduce the number of extraneous events sent by implementing the following optimization:<br>


<br>
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:<br>


<br>
&lt;canvas layout=&quot;axis: x; spacing: 5&quot; debug=&quot;true&quot;&gt;<br>
    &lt;attribute name=&quot;jay&quot; value=&quot;2&quot; /&gt;<br>
    &lt;handler name=&quot;onjay&quot;&gt;Debug.info(&quot;onjay&quot;)&lt;/handler&gt;<br>
    &lt;attribute name=&quot;kay&quot; value=&quot;4&quot; /&gt;<br>
    &lt;handler name=&quot;onkay&quot;&gt;Debug.info(&quot;onkay&quot;)&lt;/handler&gt;<br>
    &lt;attribute name=&quot;jaykay&quot; value=&quot;${jay*kay}&quot; /&gt;<br>
    &lt;handler name=&quot;onjaykay&quot;&gt;<br>
       Debug.info(&quot;onjaykay: %d * %d = %d&quot;, jay, kay, jaykay);<br>
    &lt;/handler&gt;<br>
    &lt;button onclick=&quot;canvas.setAttribute(&#39;jay&#39;, canvas.jay)&quot;&gt;Same&lt;/button&gt;<br>
    &lt;button onclick=&quot;canvas.setAttribute(&#39;jay&#39;, canvas.jay + 1)&quot;&gt;Different&lt;/button&gt;<br>
&lt;/canvas&gt;<br>
<br>
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.<br>


<br>
Comments?  Questions?<br></blockquote><div><br></div></div></div><div>I use handlers to fire functionality without actually changing any values. An example would be</div><div><br></div><div>&lt;canvas&gt;</div><div>    &lt;attribute name=&quot;update&quot; type=&quot;boolean&quot; value=&quot;false&quot;/&gt;</div>

<div>    &lt;...&gt;</div><div>       &lt;handler name=&quot;onupdate&quot; reference=&quot;canvas&quot;&gt;</div><div>           //do something</div><div>       &lt;/handler&gt; </div><div>    &lt;/...&gt;</div><div>&lt;canvas&gt;</div>

<div><br></div><div>&lt;method name=&quot;update&quot;&gt;</div><div>   canvas.setAttribute(&#39;update&#39;, true);</div></div>&lt;/method&gt;<div><br></div><div>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 &quot;touch&quot; 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. </div>

<div><br></div><div>there might be other methods to accomplish the same thing - i&#39;m just pointing out a pattern that my code depends on, currently</div><div><br></div><div>-james</div>
</blockquote></div><br><br clear="all"><br>-- <br>Henry Minsky<br>Software Architect<br><a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a><br><br><br>
</div>