(orig: any, label: string)
| 39 | const nv = getMod('nativescript-vue'); |
| 40 | const rh = getMod('nativescript-vue/dist/runtimeHelpers'); |
| 41 | const wrap = (orig: any, label: string) => { |
| 42 | if (typeof orig !== 'function') return orig; |
| 43 | if ((orig as any).__ns_wrapped__) return orig; // idempotent |
| 44 | const wrapped = function __ns_nav_wrap(component: any, params?: any) { |
| 45 | try { |
| 46 | if (__NS_ENV_VERBOSE__) { |
| 47 | console.log('[diag][nv][navigateTo]', { |
| 48 | from: label, |
| 49 | hasComp: !!component, |
| 50 | paramKeys: Object.keys(params || {}), |
| 51 | }); |
| 52 | } |
| 53 | return orig.apply(this, arguments as any); |
| 54 | } catch (e) { |
| 55 | try { |
| 56 | console.warn('[diag][nv][navigateTo][error]', (e && (e as any).message) || e); |
| 57 | } catch {} |
| 58 | try { |
| 59 | // Rescue path: attempt navigation via authoritative app Frame |
| 60 | return ((globalThis as any).__nsNavigateUsingApp as any)?.(component, params); |
| 61 | } catch {} |
| 62 | throw e; |
| 63 | } |
| 64 | } as any; |
| 65 | try { |
| 66 | (wrapped as any).__ns_wrapped__ = true; |
| 67 | } catch {} |
| 68 | return wrapped; |
| 69 | }; |
| 70 | if (nv) { |
| 71 | try { |
| 72 | if (nv.navigateTo) nv.navigateTo = wrap(nv.navigateTo, 'nv'); |
no test coverage detected