mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-18 09:39:30 -07:00
Add MapClick adapter and "fallback" logic when observations are stale
- Create utils/mapclick.mjs with centralized MapClick API functionality - Refactor modules to use the new utility: - Current Weather - Latest Observations - Regional Forecast - Add staleness checking utility for use by modules
This commit is contained in:
@@ -297,6 +297,9 @@ class AutoComplete {
|
||||
// if a click is detected on the page, generally we hide the suggestions, unless the click was within the autocomplete elements
|
||||
checkOutsideClick(e) {
|
||||
if (e.target.id === 'txtLocation') return;
|
||||
// Fix autocomplete crash on outside click detection
|
||||
// Add optional chaining to prevent TypeError when checking classList.contains()
|
||||
// on elements that may not have a classList property.
|
||||
if (e.target?.parentNode?.classList?.contains(this.options.containerClass)) return;
|
||||
this.hideSuggestions();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user