File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -69,19 +69,30 @@ export class TestgridDataContent extends LitElement {
69
69
navigateTab ( this . dashboardName , this . tabName ) ;
70
70
}
71
71
72
+ private handleTabChanged = ( evt : Event ) => {
73
+ this . tabName = ( < CustomEvent > evt ) . detail . tabName ;
74
+ this . showTab = ! this . showTab ;
75
+ this . highlightIndex ( this . tabName ) ;
76
+ navigateTab ( this . dashboardName , this . tabName ! ) ;
77
+ } ;
78
+
72
79
/**
73
80
* Lit-element lifecycle method.
74
81
* Invoked when a component is added to the document's DOM.
75
82
*/
76
83
connectedCallback ( ) {
77
84
super . connectedCallback ( ) ;
78
85
this . fetchTabNames ( ) ;
79
- window . addEventListener ( 'tab-changed' , ( evt : Event ) => {
80
- this . tabName = ( < CustomEvent > evt ) . detail . tabName ;
81
- this . showTab = ! this . showTab ;
82
- this . highlightIndex ( this . tabName ) ;
83
- navigateTab ( this . dashboardName , this . tabName ! ) ;
84
- } ) ;
86
+ window . addEventListener ( 'tab-changed' , this . handleTabChanged ) ;
87
+ }
88
+
89
+ /**
90
+ * Lit-element lifecycle method.
91
+ * Invoked when a component is removed from the document's DOM.
92
+ */
93
+ disconnectedCallback ( ) {
94
+ super . disconnectedCallback ( ) ;
95
+ window . removeEventListener ( 'tab-changed' , this . handleTabChanged ) ;
85
96
}
86
97
87
98
/**
You can’t perform that action at this time.
0 commit comments