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

Function loadInternal

packages/core/ui/builder/index.ts:183–206  ·  view source on GitHub ↗
(moduleName: string, moduleExports: any)

Source from the content-addressed store, hash-verified

181}
182
183function loadInternal(moduleName: string, moduleExports: any): ComponentModule {
184 let componentModule: ComponentModule;
185 const resolvedXmlModule = resolveModuleName(moduleName, 'xml');
186
187 if (resolvedXmlModule) {
188 const text = global.loadModule(resolvedXmlModule);
189 componentModule = parseInternal(text, moduleExports, resolvedXmlModule, moduleName);
190 }
191
192 const componentView = componentModule && componentModule.component;
193 if (componentView) {
194 // Save exports to root component (will be used for templates).
195 (<any>componentView).exports = moduleExports;
196
197 // Save _moduleName - used for livesync
198 componentView._moduleName = moduleName;
199 }
200
201 if (!componentModule) {
202 throw new Error('Failed to load component from module: ' + moduleName);
203 }
204
205 return componentModule;
206}
207
208export function loadCustomComponent(componentNamespace: string, componentName?: string, attributes?: Object, context?: Object, parentPage?: View, isRootComponent = true, moduleNamePath?: string): ComponentModule {
209 if (!parentPage && context) {

Callers 3

createViewFromEntryMethod · 0.85
loadMethod · 0.85
loadCustomComponentFunction · 0.85

Calls 2

resolveModuleNameFunction · 0.90
parseInternalFunction · 0.85

Tested by

no test coverage detected