Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Is there a problem with stacking event listeners?

Expand Messages
  • Satyam
    The destroy() method of most YUI components clean up their subscriptions explicitly because otherwise they remain taking memory. You should do the same with
    Message 1 of 2 , May 1, 2008
    • 0 Attachment
      The destroy() method of most YUI components clean up their subscriptions
      explicitly because otherwise they remain taking memory. You should do the
      same with yours.

      Satyam
      ----- Original Message -----
      From: "jacob.fogg" <jacob.fogg@...>
      To: <ydn-javascript@yahoogroups.com>
      Sent: Thursday, May 01, 2008 11:03 PM
      Subject: [ydn-javascript] Is there a problem with stacking event listeners?


      > Okay, I know the subject doesn't really explain much so let me give
      > this a shot...
      >
      > I have created an interface for rollover tips that display
      > functionality descriptions in our sites header area. If you roll over
      > a button, a description of that buttons functionality appears, and
      > when you roll out, it disappears. This interface is created simply
      > using a central function callback (rolloverTip/rolloutTip) and
      > applying an event listener using an array of id's. To extend this
      > functionality to my Iframe, I use the same method but call
      > top.rolloverTip and top.rolloutTip with the event listener. Now, with
      > 2 of my pages, from within the Iframe, I create a floating panel in
      > "top" (the parent to the iframe) to handle application settings (which
      > works beautifully!). I want to offer the same functionality of
      > rollover tips for the buttons within those panels. From the iframe I
      > can call top.initRolloverTip(idArr) which will in turn create the
      > event listeners for those buttons and everything works perfectly. When
      > I navigate away from those pages within the iframe the panel is
      > destroyed.
      >
      > So here is my question. Do I need to explicitly destroy those event
      > listeners when I destroy the panel? or is it safe to simply "forget"
      > them and re-instantiate them next time I navigate back to the iframe
      > page that creates the panel again. I should mention that "top" rarely
      > gets refreshed through the course of the application.
      >
      > I want to make sure that by *not* explicitly destroying those event
      > listeners I will not slowly eat up more and more of the browsers
      > resources through the life of the application (which could be an
      > entire 8 hour work-day).
      >
      > Thanks for your incite in this matter on such a granular level!
      >
      > Jake
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      > --
      > No virus found in this incoming message.
      > Checked by AVG.
      > Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
      > 30/04/2008 18:10
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.