-
Notifications
You must be signed in to change notification settings - Fork 61
Emitting "remove" event on App remove? #4
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
Comments
Do you think there is a need for apps to know when they are being removed (would they need to perform any tasks on removal?), or is it sufficient for containers to be the only ones that can hook into the removal process? |
I think it's sufficient for the containers to be the only ones that can hook into the removal process. That way they can remove the app from local storage for example, or from preferences on the server to keep the "workspace" state up to date. I think the app context is only relevant when it needs to be loaded, so if an app is not loaded there shouldn't be any cleaning up it needs to do itself--at least none that I can think of right now. |
What about apps needing to sever a user session? Or do some connection cleanup, i.e. destroy a link to a streaming service? I'm thinking something similar to unBeforeUnload() could be quite useful for apps, particularly in the secure (iframed) app. |
At the least, I'm noticing it would be helpful to have the removeApp function act "deferred" or non-jQuery equivalent of that so we could do things like .done() once the app is removed or have a callback fire. I'm finding that when I reload an app, sometimes it registers back in before its former instance was finished fizzling out of the container. |
If apps have an In thinking about this some more, I'm not sure if we really need to have before/during/after methods for this. The app render process needed it because beforeAppRender is prior to requesting an AppManifest; appRender is during the rendering of an app; and afterAppRender is when the app gets added to the DOM. In removing an app, there isn't much to do in F2. We just need to remove it from an internal collection of apps and remove the app from the dom. We could probably just provide an appRemove hook so that if a container needed to do anything special when removing an app from the DOM, they could do so. F2 would handle its internal cleanup and also calling a |
I have a working version of this in my app-handlers branch with unit tests to match. I would love some feedback though @FrankxMartino before submitting a formal pull request. Check it out and let me know if it looks like it will resolve this issue. |
Thanks Ali. FYI: I pulled down your version and I am taking a look. |
Just an update...This has been merged into the 1.2-wip branch. |
Before we can release this in 1.2, we need to write some more info about it in the spec: http://docs.openf2.org/container-development.html#container-config |
Inadvertently closed. Reopening. |
When Apps get removed, add the following hooks:
BeforeAppRemove
OnAppRemove
AfterAppRemove
The text was updated successfully, but these errors were encountered: