-import {Component} from "./component";
+import {Component} from './component';
export class TriLayout extends Component {
this.lastLayoutType = 'none';
this.onDestroy = null;
this.scrollCache = {
- 'content': 0,
- 'info': 0,
+ content: 0,
+ info: 0,
};
this.lastTabShown = 'content';
// Watch layout changes
this.updateLayout();
- window.addEventListener('resize', event => {
+ window.addEventListener('resize', () => {
this.updateLayout();
}, {passive: true});
}
updateLayout() {
let newLayout = 'tablet';
- if (window.innerWidth <= 1000) newLayout = 'mobile';
- if (window.innerWidth >= 1400) newLayout = 'desktop';
+ if (window.innerWidth <= 1000) newLayout = 'mobile';
+ if (window.innerWidth > 1400) newLayout = 'desktop';
if (newLayout === this.lastLayoutType) return;
if (this.onDestroy) {
for (const tab of this.tabs) {
tab.removeEventListener('click', this.mobileTabClick);
}
- }
+ };
}
setupDesktop() {
//
}
-
/**
* Action to run when the mobile info toggle bar is clicked/tapped
* @param event
*/
mobileTabClick(event) {
- const tab = event.target.dataset.tab;
+ const {tab} = event.target.dataset;
this.showTab(tab);
}
this.lastTabShown = tabName;
}
-}
\ No newline at end of file
+}