Problem
Window open event does not fire for lightweight windows when window open() method positioned before
addEventListener
The open event works as expected in 1.7.5. Hence this is a regression.
Note that the focus event also suffers the same issue.
Test case
var win = Ti.UI.createWindow({
// fullscreen:false, // enable this to workaround the issue
backgroundColor:'red'
});
win.open(); // move this after eventListeners to workaround isssue
win.addEventListener('open', function() {
Ti.API.info("------- Window event fired: open --------");
});
win.addEventListener('focus', function() {
Ti.API.info("------- Window event fired: focus --------");
});
Logs
No output produced
Workaround
Use heavyweight window or ensure that window open() method is positioned after eventListeners
I have double-checked this with
Titanium 1.9.0 (2012/01/16 11:16 366b32d)
and the issue still exists.After speaking with Opie, the fact that this worked on 1.7.5 may have simply been a race condition that we never saw due to rhino's lower performance. open and focus eventlisteners should go before the window open method. I will raise an apidoc ticket to convey this advice. Hence, closing as invalid
Closing ticket as invalid.