MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / getCore

Function getCore

packages/vite/hmr/shared/runtime/root-placeholder.ts:7–34  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

5 g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'] = true;
6 try {
7 const getCore = (name: string): any => {
8 try {
9 const reg = g.__nsVendorRegistry;
10 const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
11 let mod: any = null;
12 if (reg && reg.has('@nativescript/core')) mod = reg.get('@nativescript/core');
13 else if (typeof req === 'function') {
14 try {
15 mod = req('@nativescript/core');
16 } catch {}
17 }
18 const ns = (mod && (mod.default ?? mod)) || mod;
19 if (name === 'Application' && ns && (ns.Application || ns)) return ns.Application || ns;
20 if (ns && ns[name]) return ns[name];
21 } catch {}
22 try {
23 const nr = g.__nativeRequire;
24 if (typeof nr === 'function') {
25 try {
26 const mod = nr('@nativescript/core', '/');
27 const ns = (mod && (mod.default ?? mod)) || mod;
28 if (name === 'Application' && ns && (ns.Application || ns)) return ns.Application || ns;
29 if (ns && ns[name]) return ns[name];
30 } catch {}
31 }
32 } catch {}
33 return undefined;
34 };
35 const Application = getCore('Application');
36 const Frame = getCore('Frame');
37 const Page = getCore('Page');

Callers 1

installRootPlaceholderFunction · 0.70

Calls 2

reqFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected