Function: useObserverCreate()
useObserverCreate(
key,callback,options?,autoUnobserve?):void
Defined in: src/infrastructure/observer/observer.service.ts:70
Creates an IntersectionObserver under the given key. If an observer with the same key already exists, it is disconnected first.
Parameters
key
string
A unique identifier for this observer.
callback
Invoked when an observed element enters the viewport.
options?
IntersectionObserverInit = ...
IntersectionObserver options (default: { threshold: 0.1 }).
autoUnobserve?
boolean = true
Whether to automatically unobserve after first intersection (default: true).
Returns
void
Example
useObserverCreate("hero", (entry) => {
console.log("Hero is visible!", entry.target);
}, { threshold: 0.5 });