1// Tells .NET when the document becomes visible again (tab re-selected, window restored), so a page 2// that stays open for hours can refresh data it has no push signal for. Listener-based on purpose: 3// nothing is assigned to window.*. 4 5/** 6 * Calls `dotNetRef.invokeMethodAsync(methodName)` each time the document turns visible. 7 * @returns {{ dispose: () => void }} Removes the listener; call it when the component goes away. 8 */ 9export function observeVisibility(dotNetRef, methodName) { 10 const handler = () => { 11 if (document.visibilityState !== 'visible') return; 12 // The component may be disposing, or the runtime gone; the refresh is best effort. 13 dotNetRef.invokeMethodAsync(methodName).catch(() => { }); 14 }; 15 document.addEventListener('visibilitychange', handler); 16 return { 17 dispose() { 18 document.removeEventListener('visibilitychange', handler); 19 } 20 }; 21}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.