Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis committed Nov 28, 2024
1 parent fbfb9d7 commit 6a75df0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/ProjectLauncher.astro
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ const { idxUrl, stackblitzUrl, gitpodUrl, codesandboxUrl, menuAlign = 'left' } =
}
};

/** When removed from the DOM, remove this instance from the global set of dropdowns. */
disconnectedCallback() {
const details = this.querySelector('details');
if (details) DropDown.dropdowns.delete(details);
}

/**
* When added to the DOM, set up event listeners and add this instance to the global set of
* dropdowns.
*/
connectedCallback() {
window.removeEventListener('click', DropDown.onWindowClick);
window.addEventListener('click', DropDown.onWindowClick);
Expand Down Expand Up @@ -143,10 +153,6 @@ const { idxUrl, stackblitzUrl, gitpodUrl, codesandboxUrl, menuAlign = 'left' } =
});
}
}
disconnectedCallback() {
const details = this.querySelector('details');
if (details) DropDown.dropdowns.delete(details);
}
}

if (!customElements.get(DropDown.tagName)) {
Expand Down

0 comments on commit 6a75df0

Please sign in to comment.