mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-04 15:53:40 -07:00
25 lines
706 B
JavaScript
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;
|
|
}
|