bharal
bharal

Reputation: 16214

titanium window.open is slow

So I have a call in one window to a window.open() for a different window. This happens, of course, on a button click.

Both windows are modal = true

However, what i'd like is that when the back button on either window is pressed, I jump back to my root tabGroup.

I'd also like when i close either window I jump back to the root tabgroup.

This isn't, of course, a problem with the first window, but the second window I spawn it is... so what i did was

second.open();
first.close();

sadly, on my device this leaves a "pause" with the "unfocussed" rootTabgroup showing for a half second or so... it seems to be that before the second window opens, Titanium closes the first window... which causes the view to drop back tot he unfocussed tabGroup.

This is stupid, and ugly. I can (and have) skirted the problem just be removing the view i was using and adding a new view... but out of interest, is there a way to fully load a window and then close the current one without the amateur hour hysterics?

Upvotes: 0

Views: 755

Answers (1)

Dawson Toth
Dawson Toth

Reputation: 5680

Wait until the new window opens before closing the old window.

win2.addEventListener('open', function() { win1.close(); });
win2.open();

Or:

win2.open();
setTimeout(function() { win1.close(); }, 1000);

Upvotes: 1

Related Questions