Comments (8)
If you are talking about destroying a panel, wcDocker.removePanel()
should be used for that:
http://docker.api.webcabin.org/module-wcDocker.html#toc24
However, if you have specific things you would need to clean up while your panel is being destroyed, you should register the following event handlers for it: wcDocker.EVENT.CLOSING
and/or wcDocker.EVENT.CLOSED
. One happens before, and the other happens right after the panel has been destroyed.
http://docker.api.webcabin.org/module-wcDocker.html#toc4
Does this help?
from wcdocker.
Hello Jeff,
My colleague has missed to describe the scenario.
We build a Single Page Application with Angular. We have several modules with different content.
When the user switch from one module to another, angular, for been precise the ui-router will remove the docker-directive and create a new instance.
In the docker-directive we will watch the directive destroy event. When this event occurs we have to clean up the memory. We have to dispose the panel but also the docker instance.
Therefore a destroy function which knows the docker events etc. would be helpful.
How can we handle this use case?
Thank you,
Alexander
from wcdocker.
Ahh, I don't know why I did not name it wcDocker.destroy()
, but there is a wcDocker.clear()
which does exactly this. It will destroy all panels and other bits that make up the interface. I noticed that I forgot to also clean up referenced event handlers that have been applied directly to wcDocker, so I will add that asap.
wcDocker.clear()
method: http://docker.api.webcabin.org/module-wcDocker.html#toc13
After calling this, it should be safe to simply un-reference the wcDocker object and allow the browser to garbage collect it. Also note, the clear method only triggers wcDocker.EVENT.CLOSED
, and NOT wcDocker.EVENT.CLOSING
, in case you have specific cleanup done in that one.
from wcdocker.
I noticed that I forgot to also clean up referenced event handlers that have been applied directly to
wcDocker, so I will add that asap.
Perfect Jeff, clear() works for now and is excactly what I was looking for.
Would be nice to have the wcDocker-events removed too by using clear()...
from wcdocker.
It should, actually. I've committed that change right after I mentioned it ;)
from wcdocker.
@Lochemage ah you mean your exposed wcDocker-events - i see.
Iยดm talking about the browser/jQuery events, which still stay in the memory when using clear():
https://www.youtube.com/watch?v=J0D5h5dIUg4&feature=youtu.be
from wcdocker.
I do not know if this is very smart, but since you use event-delegation, the simplest way to "decouple" the events would be to bind to $('body.wcDesktop') instead of $('body') and removing the class wcDesktop from body when using clear().
I mean the most stable solution would be to remove every single event manually...
What do you think?
from wcdocker.
Ahh, I understand. wcDesktop
would not work, that class is only applied if you are running it on a desktop PC, otherwise you get wcMobile
.
As for the mouse handler events, I have some plans to refactor that somewhat, I'll make sure this also includes unbinding them.
from wcdocker.
Related Issues (20)
- Can wcDocker "just" restore the positions/dims of panels without re-instantiation? HOT 5
- Using 'Panel Creation Elements' breaks creation of panels via context menu
- Docker panel resize HOT 1
- Docker is in infinite loop HOT 2
- Cannot move the stacked Iframe panel into the browser tab. HOT 1
- mobile device events
- Embedded wcDocker instance or otherwise constraining panels to one layout HOT 3
- Can I use wcDocker with angular2? HOT 2
- Provide dynamic options via addPanel HOT 3
- Improved forked version available - bug fixes and performance
- PopOut Browser
- restoring a layout refreshes iframes HOT 1
- Scroll position resets after resize panel HOT 1
- Using moveable(false) causes Browser window hang HOT 5
- wcDocker Frame do not load URL when we use jQuery v.3.3.1
- Any light Theme?
- How do I prevent a panel from resizing?
- Is it possible to localize the context menu?
- Localization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wcdocker.