Refactor: Move custom source changed event dispatch to the end of handleSourceChange
This commit is contained in:
parent
b871c17fbc
commit
5b316f2d8a
1 changed files with 10 additions and 10 deletions
|
|
@ -14,16 +14,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
selectedCategory = sourceCategoriesData.find(sc => sc.id == selectedValue);
|
selectedCategory = sourceCategoriesData.find(sc => sc.id == selectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch a CustomEvent for forks (like Bruxelles Mobilité) to run custom logic
|
|
||||||
const event = new CustomEvent('streetup:source-changed', {
|
|
||||||
detail: {
|
|
||||||
value: selectedValue,
|
|
||||||
text: selectedText,
|
|
||||||
category: selectedCategory
|
|
||||||
}
|
|
||||||
});
|
|
||||||
document.dispatchEvent(event);
|
|
||||||
|
|
||||||
// Standard core behavior:
|
// Standard core behavior:
|
||||||
// 1. Toggle source detail visibility
|
// 1. Toggle source detail visibility
|
||||||
if (sourceDetailContainer) {
|
if (sourceDetailContainer) {
|
||||||
|
|
@ -45,6 +35,16 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
sourceRefContainer.classList.add('d-none');
|
sourceRefContainer.classList.add('d-none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dispatch a CustomEvent for forks (like Bruxelles Mobilité) to run custom logic
|
||||||
|
const event = new CustomEvent('streetup:source-changed', {
|
||||||
|
detail: {
|
||||||
|
value: selectedValue,
|
||||||
|
text: selectedText,
|
||||||
|
category: selectedCategory
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceCategorySelect) {
|
if (sourceCategorySelect) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue