I have widgets running in an iBook. In particular, they play some music and sounds, as well as a Javascript "main loop".
I'd like sound and music to stop whenever the Widget is closed by the user. I don't know if there is some "FocusLost" or "WidgetClosed"-like event fired up by the iBook.
To my current understanding, this use case doesn't fire up "onunload", because this one would run whenever the iPhone decides to reclaim some memory because it needs it for the page the user is currently on.
What's the standard solution to this problem?