It's a little complicated implementation-wise to try and do well right now, but the basic idea is that you don't define the function to fire the event to in such a way that you can't call disconnect on the same thing again.
As an example (though complicated): http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script?view=markup dojo.event.browser.clean(node) will help memory leaks for IE specifically. This isn't really a mistake or oversight. If browsers provided a removeAllListeners() function I'm sure everyone would love to see it, otherwise you'd have to keep a local reference to all of them in some sort of global manager. (if you feel safe with things like that) So yeah...define a function , then event.connect () it, after you're done event.disconnect. It's not fun. Of course I've made some changes in 4.1.1 that have made my life much easier in this regard but I know that doesn't help you now. On 12/10/06, Sam Gendler <[EMAIL PROTECTED]> wrote:
I'm cross posting this from tacos-dev because I am up against a deadline and in a very inconvenient timezone, so I'm looking for an answer in a hurry. I need to attach an event to one cell of each row in a table that gets updated via a tacos ajax call. How do I go about ensuring that the event is disconnected before the update. The table is a component, so I don't have an easy way to just modify the js that might execute before an ajax update fires to show a new page or sort order, although I can do that if I have to. I could also write code that gets sent with the update which will disconnect events when the next page loads, if I have to, by storing an array with global scope and iterating. But is there an easier way to accomplish this? For that matter, do I need to bother? I am under the impression that failing to disconnect events on nodes that are otherwise dereferenced from the DOM will result in a leak, at least in some browsers. Perhaps I am mistaken? dojo version is 0.4.1 --sam --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
