mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
* use intersection observer to fix dynamic content load issue * set up mock intersection observer * Create reusable hasScrollable content util * return null from resize to fix type error * remove Observer mock * return observable * refactor util and remove resize * use async pipe for observable in template * remove comment left in error
18 lines
446 B
TypeScript
18 lines
446 B
TypeScript
import { Observable } from "rxjs";
|
|
|
|
/** IntersectionObserver Observable */
|
|
export const intersectionObserver$ = (
|
|
target: Element,
|
|
init: IntersectionObserverInit,
|
|
): Observable<IntersectionObserverEntry> => {
|
|
return new Observable((sub) => {
|
|
const io = new IntersectionObserver((entries) => {
|
|
for (const e of entries) {
|
|
sub.next(e);
|
|
}
|
|
}, init);
|
|
io.observe(target);
|
|
return () => io.disconnect();
|
|
});
|
|
};
|