Problem description
Adding a custom event listener to a window, then closing and re-opening the window, does not fire the event.
Steps to reproduce
Use the following code; when switching between win2 and win1, the fireEvent does not work; it is working fine on iOS.
var win1 = Ti.UI.createWindow({
backgroundColor: "#FFF",
layout: "vertical",
fullscreen: true
});
var win2 = Ti.UI.createWindow({
backgroundColor: "#CCC",
layout: "vertical",
fullscreen: true
});
var addSwitchButton = function(caption, newWindow, oldWindow) {
var switchButton = Ti.UI.createButton({
title: caption,
top: 50,
height: 50
});
oldWindow.add(switchButton);
switchButton.addEventListener("click", function(e) {
newWindow.open({
animated: false
});
oldWindow.close({
animated: false
});
newWindow.fireEvent("customEvent", {
firedFromButton: false
});
});
};
addSwitchButton("Switch to window 2.", win2, win1);
addSwitchButton("Switch to window 1.", win1, win2);
win1.addEventListener("customEvent", function(e) {
Ti.API.info("Custom Event, fired from button: " + (e.firedFromButton ? "yes" : "no"));
});
var testButton = Ti.UI.createButton({
title: "Fire custom event.",
top: 50,
height: 50
});
win1.add(testButton);
testButton.addEventListener("click", function(e) {
win1.fireEvent("customEvent", {
firedFromButton: true
});
});
win1.open();
Resolving this as per updated test results. We tested the issue with TISDK 3.2GA and we could not reproduce it.
Closing ticket as fixed.