-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpanel-set.mjs
More file actions
32 lines (28 loc) · 924 Bytes
/
panel-set.mjs
File metadata and controls
32 lines (28 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(async function(window, document){
if(typeof window === 'undefined'){ return; }
const { initialize } = await import('./panel-set-helpers.mjs');
const customElementName = 'panel-set';
if (!window.customElements.get(customElementName)) {
window.customElements.define(customElementName,
class PanelSet extends HTMLElement {
static get observedAttributes() {
return [];
}
constructor(){
super();
this.root = null;
this.activeIndex = null;
this.activePanel = null;
this.activeTab = null;
this.hasRendered = false;
}
connectedCallback(){
if(!this.root) { this.root = this.attachShadow({ mode: 'open' }); }
initialize(this);
this.hasRendered = true;
window.addEventListener('resize', () => initialize(this));
}
}
);
}
})(window, document);