Files
brk/website_next/explore/index.js
T
2026-07-03 21:06:32 +02:00

25 lines
706 B
JavaScript

import { createBlockDetails } from "./block/index.js";
import { createChain } from "./chain/index.js";
export function createExplorePage() {
const main = document.createElement("main");
const blockDetails = createBlockDetails();
const chain = createChain({
onSelect: blockDetails.update,
});
main.className = "explore";
main.append(chain.element, blockDetails.element);
const syncChain = () => chain.setActive(!main.hidden && !document.hidden);
main.addEventListener("pageactive", syncChain);
document.addEventListener("visibilitychange", syncChain);
new MutationObserver(syncChain).observe(main, {
attributes: true,
attributeFilter: ["hidden"],
});
return main;
}