chore: complete update

This commit is contained in:
2025-07-17 16:24:20 +02:00
parent 899227b0a4
commit 64a7051137
1300 changed files with 85570 additions and 2756 deletions

View File

@@ -0,0 +1,49 @@
// modules/core/EventManager.js
const registry = new Map();
export const EventManager = {
/**
* Fügt einen EventListener hinzu und speichert ihn im Modul-Kontext
*/
add(target, type, handler, { module = 'global', options = false } = {}) {
target.addEventListener(type, handler, options);
if (!registry.has(module)) registry.set(module, []);
registry.get(module).push([target, type, handler, options]);
},
/**
* Entfernt alle Listener, die für ein bestimmtes Modul registriert wurden
*/
removeModule(module) {
const entries = registry.get(module);
if (!entries) return;
entries.forEach(([target, type, handler, options]) => {
target.removeEventListener(type, handler, options);
});
registry.delete(module);
},
/**
* Entfernt alle Event-Listener aus allen Modulen
*/
clearAll() {
for (const [module, entries] of registry.entries()) {
entries.forEach(([target, type, handler, options]) => {
target.removeEventListener(type, handler, options);
});
}
registry.clear();
},
/**
* Debug: Gibt die aktuelle Registry in der Konsole aus
*/
debug() {
console.table([...registry.entries()].map(([module, events]) => ({
module,
listeners: events.length
})));
}
};