Coder Social home page Coder Social logo

Comments (8)

Lochemage avatar Lochemage commented on July 28, 2024

@lomotelsch

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.

AFamularo-lomoSoft avatar AFamularo-lomoSoft commented on July 28, 2024

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.

Lochemage avatar Lochemage commented on July 28, 2024

@AFamularo-lomoSoft

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.

lomotelsch avatar lomotelsch commented on July 28, 2024

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.

Lochemage avatar Lochemage commented on July 28, 2024

@lomotelsch

It should, actually. I've committed that change right after I mentioned it ;)

from wcdocker.

lomotelsch avatar lomotelsch commented on July 28, 2024

@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.

lomotelsch avatar lomotelsch commented on July 28, 2024

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.

Lochemage avatar Lochemage commented on July 28, 2024

@lomotelsch

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.