View Single Post
Old 04-09-2013, 10:25 AM   #39
PaulFreund
*
PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.PaulFreund understands the importance of being earnest.
 
PaulFreund's Avatar
 
Posts: 35
Karma: 145852
Join Date: Apr 2013
Device: Kindle Touch
Quote:
Originally Posted by silver18 View Post
I'm facing the same problem.
You could use

Code:
kindle.appmgr.onunload = function() { };
or the stock

Code:
window.onunload = function() { };
As regards me, I need something a bit more complicated as I have mutiple HTMLs (and the first solution seem to work only in the landing page) and some other problems here and there.
I suggest wrapping the application in a Kindle object as I did in WebLaunch

This allow you to hook into "go", "unload" and "pause". "pause" is executed when the app leaves focus and "go" when it comes to focus. I think "unload" should be called when the app is really terminating, but I didn't capture that event yet.

When creating the base application with the Kindle template you can use kindle.chrome.createContentWindow() to load your other pages and keep the code active.
PaulFreund is offline   Reply With Quote