I have a tab based iOS app. In the itemedit tab the user can change some item names that get stored in properties. Before they return to the items tab I want to redraw the elements to reflect these changes. I could do this in a focus event on return to item.js, but then the user sees the items being redrawn and I want to avoid that. So I'm using firevent from the itemedit tab. The problem with what I have now, it that the event seems to fire twice, once from itemedit.js and then again when I return to items.js. I've tried removing the itemupdate fire event inside the itemupdateCB function, but then it can only be used once, and the event needs to be fired more than once from itemedit.js.
in items.js
var itemupdateCB = function(e) { alert('fire!'); setupItems(); }; Ti.App.addEventListener('itemUpdate', itemupdateCB);in itemedit.js
for (var x=1;x<=num;x++){ var view = Ti.UI.createView({ }); //add event listener itemNames[x].addEventListener('blur',function(e){ Ti.App.Properties.setString('item'+e.source.id, e.value); Ti.App.fireEvent('itemUpdate'); }); view.add(itemNames[x]); }I've noticed that if I add the fireEvent to the itemedit tab blur event it doesn't fire again when opening the item tab, but I would like it to happen before that. I'm guessing there are things going on with the global scope and how things are getting added in that loop that I don't understand, so hoping someone can explain what's going on here.