Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to unload and destroy a view. #3

Open
edchat opened this issue Sep 6, 2013 · 7 comments
Open

Add support to unload and destroy a view. #3

edchat opened this issue Sep 6, 2013 · 7 comments
Assignees
Milestone

Comments

@edchat
Copy link
Contributor

edchat commented Sep 6, 2013

This support will be added to the Load controller.
There will be a new event called "app-unload-view" to handle unloading and destroying a view. Calls to use the new "app-unload-view" would look like this:

params.view = view; 
this.app.emit("app-unload-view", params); 

I would also like to add some config options to make it easy to avoid having too many views loaded. Perhaps support for the app or a view to have these options:
"alwaysAutoUnload": which if set to true means the view will automatically be unloaded and destroyed after afterDeactivate is called for the view.

"autoUnloadCount": which is set to a number which is used to determine how many views (per constraint) to leave loaded when transitioning in the application.

"neverAutoUnload": which if set to true means this view will never be automatically unloaded and destroyed no matter how many views are loaded.

@ghost ghost assigned edchat Sep 6, 2013
@edchat
Copy link
Contributor Author

edchat commented Sep 11, 2013

Christophe suggested that in addition to support for unloading a view with the emit of the "app-unload-view" event we should add a function which can be called to unload the view as well to make it easier for an app to unload views.

edchat added a commit to edchat/dapp that referenced this issue Sep 19, 2013
@nickcmaynard
Copy link

Agreed with Christophe's suggestion.

Back in the dojox/mobile world, I've often found myself dynamically creating and reaping hierarchical structures - ie. only when transferring up the hierarchical view tree, as opposed from any deactivation.

I'd need to control this kind of logic programmatically, so a function would be helpful.

@edchat
Copy link
Contributor Author

edchat commented Nov 8, 2013

I will add an unloadView function was added to main.js, it will take these parameters:
(/Object/view, /function?/callback)
So a call would look like:
app.unloadView(/Object/view, /function?/callback);

edchat added a commit to edchat/dapp that referenced this issue Nov 8, 2013
…ons on a view to alwaysAutoUnload:(the view will be unloaded after afterDeactivate every time the view is shown), neverAutoUnload(the view will never be unloaded automatically, no matter how many views are loaded), and use an autoUnloadCount(is set to a number which is used to determine how many views per constraint to leave loaded when transitioning). Fixes issue ibm-js#3
@cjolif
Copy link
Contributor

cjolif commented Nov 8, 2013

shouldn't it be promised based instead of callback?

@edchat
Copy link
Contributor Author

edchat commented Nov 8, 2013

Yes, but I am going to have to convert all of the events that are using callbacks to be promise based, so I was thinking that I would do those all at the same time, if that is OK. I actually did not have any cases where the callback was needed, but thought it should be there just in case.

@cjolif
Copy link
Contributor

cjolif commented Nov 9, 2013

that's indeed fine doing it later.

@cjolif cjolif added the 3-high label Jun 18, 2014
@edchat
Copy link
Contributor Author

edchat commented Jun 18, 2014

The basic view unload support is in, the event is "dapp-unload-view", but it is currently only called for app.unloadApp(). I still need to add the auto unload options listed above, and the app.unloadView(...) support.

@edchat edchat added this to the 0.4.0 milestone Sep 8, 2014
@cjolif cjolif modified the milestones: 0.5.0, 0.4.0 Sep 16, 2014
@edchat edchat modified the milestones: 0.5.0, 0.4.0 Jan 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants