Global / App events list
Where can I find a list of all application level events, i.e. things like "application exits" and similar?
I would assume that there are such events, but I can't find documentation for them.
If there is no such list to link to, can someone please provide it in short form? I mean there must be some basic app level events like for startup and exit?
(Example for background: What if I'd like to implement some state saving functionality that executes when the app is about to exit?)
5 Answers
-
Is there any conclusion on this topic? I've just hit it: I need to run some function when the app starts and when the app closes. I assume I should be able to catch these app-level events somehow. However, when I add the following lines I see that only 'pause' and 'resume' work:
Titanium.App.addEventListener('open', function (e) { Ti.API.info('app.js: Open event on '+Ti.Platform.osname); }); Titanium.App.addEventListener('close', function (e) { Ti.API.info('app.js: Close event on '+Ti.Platform.osname); }); Titanium.App.addEventListener('pause', function (e) { Ti.API.info('app.js: Pause event on '+Ti.Platform.osname); }); Titanium.App.addEventListener('resume', function (e) { Ti.API.info('app.js: Resume event on '+Ti.Platform.osname); });
I see only pause and resume events are fired.
-
Hey, you have to put the open/close listeners on your main window…
var main_window = Ti.UI.createWindow(); main_window.open(); main_window.addEventListener('open', function(e){ ... });
-
You don't need the "open" event. Just put your code in app.js which is interpreted only once.
-
Events for each object is in the API documentation under the event section.
For example, for mobile window object events see: http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Window-object
-
read this thread - first answer by Jeff.