File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 22 Component ,
33 HostBinding ,
44 HostListener ,
5+ OnDestroy ,
56 OnInit ,
67 input ,
78 signal ,
@@ -14,7 +15,7 @@ import {
1415 imports : [ ] ,
1516 standalone : true ,
1617} )
17- export class NgxScrollTopComponent implements OnInit {
18+ export class NgxScrollTopComponent implements OnInit , OnDestroy {
1819 /**
1920 * Background color of the back to top button (hex string).
2021 *
@@ -161,6 +162,15 @@ export class NgxScrollTopComponent implements OnInit {
161162 this . updatePosition ( ) ;
162163 }
163164
165+ public ngOnDestroy ( ) : void {
166+ if ( this . fadeTimeout ) {
167+ clearTimeout ( this . fadeTimeout ) ;
168+ }
169+ if ( this . animationFrameId ) {
170+ cancelAnimationFrame ( this . animationFrameId ) ;
171+ }
172+ }
173+
164174 /** Scroll smoothly to the top of the window. */
165175 public scrollTop ( ) : void {
166176 window . scroll ( {
You can’t perform that action at this time.
0 commit comments