Question

I know how to open windows in Alloy, but I am worried about the effect on performance of opening lots of windows. In Classic titanium, you had to manage this carefully to avoid memory leaks, but i've seen very little on this for Alloy. Is this handled somehow by Alloy behind the scenes - can I just keep opening windows to my heart's content?

So if I have index.js opening category.js, which then opens product.js, but there is a button to open index.js - how do I handle that?

Was it helpful?

Solution

Try this: https://developer.appcelerator.com/question/176491/alloy-close-the-window-clear-the-memory

Simply closing the window does not free up any memory that has references open from within the menu or any child views/function of the window. It is common to create a cleanup method and publicly expose this from the controller. You then make sure that anything you created or referenced inside this controller has been nulled, removed or reset - within this function. Add an event listener to the window inside the controller to handle the close event and then have it call the clean-up function. Finally removing that event listener as well. Some things to check for in your clean-up function Event Listener - use Remove Event Listener once they are nbo longer required For tables simply use table.setData([]); nothing more complicated than that If you use setTimeout or setInterval you must always clear(thing) each of these There are more but these are the highlights.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top