Jeff

Jeff

  • NA
  • 15
  • 0

Confused about when to Unsubscribe from a custom event

Jul 6 2011 1:14 AM
Hi,

I would like to start using Custom Events in some of my applications however I am a little confused about the when to Unsubscribe from them.

For example, say I have a web based application which has several modules. Module 1 manages a Taxi driver and their shift, Module 2 manages expenses and Module 3 manages inventory. So my taxi drive goes to work and fills up the tank with gas. When he comes back to base, he fills a form from Module 1 in that says he bought some gas and spent $50.

I want Module 2 and Module 3 are interested to hear of this expenditure and need to subscribe to an OnFuelPurchased event.

That part I get, as the Module 1 page loads, I subscribe the Module 2 and 3 event handlers. No worries.

What I don't understand is where do I unsubscribe from the events? I read that I need to so I don't have memory leaks but don't see where I do it?

Thanks
Jeff

Answers (2)