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

Function registerLink

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

Source from the content-addressed store, hash-verified

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

Callers 1

registerSpectrumLinkFunction · 0.85

Calls 1

isClientLinkFunction · 0.90

Tested by

no test coverage detected