feat: implement dynamic knowledge graph updates and state management services

This commit is contained in:
2026-04-26 14:53:48 +02:00
parent 412320980f
commit 7859c9806f
30 changed files with 668 additions and 153 deletions
@@ -0,0 +1,22 @@
export function initObserver(dotNetHelper, containerSelector, itemSelector) {
const options = {
root: null,
rootMargin: '0px',
threshold: 0.6 // 60% of the block must be visible
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const id = entry.target.id;
const content = entry.target.innerText;
dotNetHelper.invokeMethodAsync('HandleBlockReached', id, content);
}
});
}, options);
const items = document.querySelectorAll(itemSelector);
items.forEach(item => observer.observe(item));
return observer;
}