Comments (7)
This will trigger when you change the view as well causing massive lag between views, unfortunately. Encountered that few days ago while creating my isotope wrapper.
from angular-slick.
@grabbou What do you mean by "this".
@deedarb's suggestion, or the plugin as is.
from angular-slick.
This = scope.$on('destroy') event. The thing is - when you have 100 items in your slider and you navigate to another route using ui-router causing the whole view to be rendered once again using different templates, you will notice massive lag as destroy will be called 100 times. AFAIK once item is removed from DOM, event listeners should be GC anyway. Haven't noticed any lags in my code because of that. $destroy can be called on main angular-slick directive to do the clean up but not on single elements tough.
from angular-slick.
@grabbou Event listeners on DOM elements (in the dom or not) are not automatically GC'ed. I don't think anyone is suggesting that $destroy
is called 100 time for 100 slides. That would only happen when you have 100 instances of <slick>
directive.
See this
from angular-slick.
Ah, sorry. I thought that we have 'sub directive' inside directive that displays every single slide. In that case, $destroy event is completely fine. In 99% cases though memory consumed by event handlers triggered on DOM elements is trivial compared to the overall memory used by a webpage. But again, having checked the code once again, it's an easy way to improve code quality.
from angular-slick.
I have tested for memory leak, and this does cause memoery leak. I have fixed this for now by by wrapping this in my own directive. Came here searching for existing issues before I make a PR, then noticed the source is coffeescript as mentioned in OP.
Please add a destroy handler.
from angular-slick.
memory consumed by event handlers triggered on DOM elements is trivial
Yes. But in angular this causes the detached elements to stay in memory, some of these elements holds references to scope(s), scope holds references to parent scopes, child scopes etc and they holds references to lots of data. Eventually those tiny handlers cause huge memory leak. This is a serious issue than just an improvement to code quality...
from angular-slick.
Related Issues (20)
- slick execution in ng-repeat HOT 2
- Unslick failure
- Can't swipe back with swipe to slide HOT 1
- Slide when number of slide is less than or equal to slides-to-show HOT 2
- Using boolean('false') always returns true HOT 1
- useCSS property does not work
- Bug doesnt display anything until autoplay begins HOT 1
- slides to scroll setting is not working in last page
- As-nav-for is not working with touch.
- Dragging makes my list disappear HOT 3
- angular slick carousel does not respect viewBox of the ng-md-icon
- ng-click on mobile dont work HOT 1
- Can't disable draggable property
- how to ban cycle?
- how to init current-index
- Cannot read property 'add' of null
- slider.unslick is not a function
- Dragend triggers click
- Passing Slick as dependency with ng-route does not load it HOT 2
- $ is not a function
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 angular-slick.