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

Function emitStackChange

packages/react-aria-components/src/Sheet.tsx:166–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164let stackListeners = new Set<() => void>();
165
166function emitStackChange() {
167 // Hoist every mounted sheet's timeline name to the root so a parent
168 // can still resolve the child's timeline by name.
169 // TODO: don't override existing timelines declared in CSS or inline styles.
170 let names = Array.from({length: sheetStack.length})
171 .map((_, i) => `--sheet-timeline-${i}`)
172 .join(', ');
173 document.documentElement.style.setProperty('timeline-scope', names);
174 stackListeners.forEach(listener => listener());
175}
176
177function subscribeStack(listener: () => void) {
178 stackListeners.add(listener);

Callers 1

registerSheetFunction · 0.85

Calls 1

listenerFunction · 0.85

Tested by

no test coverage detected