(reason: string)
| 373 | } |
| 374 | |
| 375 | export function logUiSnapshot(reason: string) { |
| 376 | try { |
| 377 | const g: any = globalThis as any; |
| 378 | const F = getCore('Frame') || g.Frame; |
| 379 | const App = getCore('Application') || g.Application; |
| 380 | const top = F?.topmost?.(); |
| 381 | const rootView = App?.getRootView ? App.getRootView() : undefined; |
| 382 | const page = top?.currentPage || top?._currentEntry?.resolvedPage || null; |
| 383 | const info = { |
| 384 | reason, |
| 385 | placeholderActive: !!(g.__NS_DEV_PLACEHOLDER_ROOT_VIEW__ || g.__NS_DEV_PLACEHOLDER_ROOT_EARLY__), |
| 386 | activityReady: !!(App?.android && (App.android.foregroundActivity || App.android.startActivity)), |
| 387 | topFrame: top |
| 388 | ? { |
| 389 | ctor: top.constructor?.name, |
| 390 | backstack: (top as any)?._backStack?.length || 0, |
| 391 | } |
| 392 | : null, |
| 393 | rootView: rootView ? { ctor: rootView.constructor?.name } : null, |
| 394 | currentPage: page |
| 395 | ? { |
| 396 | ctor: page.constructor?.name, |
| 397 | tag: (page as any)?.__ns_hmr_tag || (page as any)?.__ns_diag_tag, |
| 398 | title: (page as any)?.title, |
| 399 | } |
| 400 | : null, |
| 401 | }; |
| 402 | console.log('[diag][ui]', info); |
| 403 | } catch {} |
| 404 | } |
no test coverage detected