Add TypeScript types to utils.ts (issue #17)
- Add types to all function parameters and return values - Replace getEl() with native document.querySelector() throughout - Fix removeEventListener bug (was removing wrong function reference) - Fix disabled property: use boolean true/false instead of strings - Add ElementHandlerConfig labeled tuple type for conditionalElementHandler Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getEl, disableElementsWhenTrue, onSwap } from "./utils.js";
|
||||
import { disableElementsWhenTrue, onSwap } from "./utils.js";
|
||||
|
||||
const RELATED_PURCHASE_URL = "/tracker/purchase/related-purchase-by-game";
|
||||
|
||||
@@ -11,7 +11,7 @@ document.addEventListener("search-select:change", (event) => {
|
||||
const last = event.detail.last;
|
||||
const platformId = last && last.data ? last.data.platform : "";
|
||||
if (platformId) {
|
||||
const platformEl = getEl("#id_platform");
|
||||
const platformEl = document.querySelector("#id_platform");
|
||||
if (platformEl) platformEl.value = platformId;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ document.addEventListener("search-select:change", (event) => {
|
||||
})
|
||||
.then((html) => {
|
||||
if (html === null) return;
|
||||
const target = getEl("#id_related_purchase");
|
||||
const target = document.querySelector("#id_related_purchase");
|
||||
if (target) target.outerHTML = html;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user