MCPcopy Create free account
hub / github.com/adobe/react-spectrum / registerLink

Function registerLink

packages/dev/s2-docs/src/prefetch.ts:72–79  ·  view source on GitHub ↗
(element: HTMLAnchorElement | null)

Source from the content-addressed store, hash-verified

70 : null;
71
72export function registerLink(element: HTMLAnchorElement | null) {
73 if (!element || !isClientLink(element) || element.pathname === location.pathname) {
74 return;
75 }
76
77 observer?.observe(element);
78 return () => observer?.unobserve(element);
79}
80
81export function registerSpectrumLink(value: DOMRefValue<HTMLAnchorElement> | null) {
82 return registerLink(value?.UNSAFE_getDOMNode() || null);

Callers 1

registerSpectrumLinkFunction · 0.85

Calls 1

isClientLinkFunction · 0.90

Tested by

no test coverage detected